I am receiving the following error:
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean ... on line 42
I have tried to test my SQL query directly in phpmyadmin and no error occurs. I cannot see why this is happening, since the query seems valid.
The code is:
$link = mysqli_connect($sql_host, $sql_usr, $sql_passwd,$sql_db);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$query = "SELECT Approver_Id, Approver_Name, Approver_Email FROM Approver WHERE Approver_Name=".$username."";
$result = mysqli_query($link,$query);
if (mysqli_num_rows($result) > 0) // <--- Line 42
{
// Something top secret happens here ;)
}