So, I have a prepared statement that I have successfully prepared, bound, and executed:
SELECT * FROM users WHERE email = ? AND pass = SHA1(?)
It looks like one row is returned, as expected. However, why is the $result variable empty when I call @$stmt->get_result()? Thanks in advance.
$num_rows = mysqli_num_rows($stmt->get_result());
if ($num_rows == 1) {
// Fetch the result set
$result = $stmt->get_result();
//if result empty echo false
if(empty($result)) {
echo "result is empty";
}
}
get_result()at the start of your code, and then call it again inside the if statement - are you sure that it'll return what you're expecting the second time it's called?