Hi to everyone,
I am preparing the log-In page and when I am going to controll if the user is present in the user-list with two fields: matricola and password, MySQL return zero record.
I do not understand where is the error because I am novice in programming with PHP.
The code is:
function controlUser($matricola, $password)
{
include $_SERVER['DOCUMENT_ROOT'] . '../db.conn.php';
try
{
$sql = 'SELECT COUNT(*) FROM personale WHERE Matricola = :matricola AND password = :password';
$s = $pdo -> prepare($sql);
$s -> bindValue(':matricola', $matricola);
$s -> bindValue(':password', $password);
$s -> execute();
}
catch (PDOException $e)
{
$error = 'Errore durante la ricerca!';
include $_SERVER['DOCUMENT_ROOT'] . '../error.html.php';
exit();
}
$row = $s -> fetch();
if ($row[0] > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}