Query returning zero rows despite entries existing

19 views Asked by At

I have these prepared statements below. I perform the execute and both return 1, meaning the query was successful, but num_rows is still zero. I don't know why. Any ideas?

$ustmt = $bd->prepare("SELECT * FROM member WHERE username = ?");
$ustmt->bind_param("s", $username);

$astmt = $bd->prepare("SELECT address FROM member WHERE address = ?");
$astmt->bind_param("s", $address);

$sql = $ustmt->execute();
$sql2 = $astmt->execute();

echo($sql2);
echo($sql);

echo($ustmt->num_rows);
echo($astmt->num_rows);
1

There are 1 answers

0
user3822332 On

I had forgotten to add store_result(); after I had executed. I have wasted a lot of hours!