Mysqli help
Posted: Wed May 19, 2010 11:14 am
How do I check if a query has returned any results? I tried it below, but can't seem to get it to work as $result->num_rows always returns 0 even when there is data in the result set.
Thanks.
Code: Select all
$sql = "SELECT email, password FROM user WHERE email = '" . $email . "'";
mysqli->query($sql);
$result = mysqli->use_result();
$result->num_rows; //Keeps returning 0 even when there is data.