I am trying to write a very simple query in php.
$conn = createConnection();
$sql = "select count(username) from passenger where username = '$passengerId' and password ='$password'";
$result = mysql_query($sql);
$count = mysql_result($result, 0);
echo $count;
if ($count == 1)
echo "true == 1";
else
echo "false != 1";
echo print_r(mysql_result($result, 0));
echo $count;
at the end, echo print_r(mysql_result($result, 0)) gives me 1 as expected, but echo $count does not print anything. Also the if statement give me false != 1. I am not sure what kind of problem occurs here.
echo "<pre>[$count]</pre>";orvar_dump($count);instead of justecho $count;, you might get spaces, or other things.var_dump($count);give me NULL. Do you know the reason?mysqliand enableerror reporting.