尽管存在条目,查询返回零行

时间:2015-06-07 13:21:46

标签: php mysqli prepared-statement

我在下面有这些准备好的陈述。我执行执行并返回1,意味着查询成功,但num_rows仍为零。我不知道为什么。有什么想法吗?

$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 个答案:

答案 0 :(得分:0)

我忘了添加store_result();我执行完毕后我浪费了很多时间!