【发布时间】:2009-11-17 10:10:57
【问题描述】:
我有一个问题,我准备好的语句似乎只返回返回的行数而不是行的值。下面是我的代码。我确实为此尝试了谷歌,但它没有告诉我任何事情!如果有人能告诉我我做错了什么以及如何解决它,我将非常感激。谢谢
$query2 = 'SELECT * FROM kids_entry WHERE email = ?';
$stmt2 = $connection->prepare($query2);
// bind the user id as an integer to the first ?
$stmt2->bind_param('s', $email);
$stmt2->execute(); // execute the statement
$stmt2->store_result(); // this call is required for the next operation
while($row1 = $stmt2->fetch()){
printf ("%s \n", $entries);
}
编辑
我只是尝试用 while 循环替换 if 并且得到了同样的结果。
编辑 2
添加了新代码后它可以工作,但我如何将它分配给 $variable?
【问题讨论】:
标签: php mysqli prepared-statement