1
我有一个问题,我的预处理语句似乎只返回返回的行数而不是行的值。以下是我的代码。我确实为此尝试了谷歌,但它并没有告诉我任何东西!如果有人能告诉我我做错了什么以及如何解决这个问题,我会非常感激。由于使用预处理语句返回特定行
$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循环和我有同样的事情。
EDIT 2
已增加它的工作原理的新代码,但如何将我分配这一个变量$?
感谢。任何想法如何将它分配给一个变量? – Drew
分配给变量的含义是声明变量,然后使用bind_result绑定到结果集并调用fetch,变量包含行的值。您应该先阅读文档。 –