致命错误:调用未定义的方法mysqli_stmt :: fetch_array() [英] Fatal error: Call to undefined method mysqli_stmt::fetch_array()
本文介绍了致命错误:调用未定义的方法mysqli_stmt :: fetch_array()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此代码中,我得到错误:致命错误:调用未定义方法mysqli_stmt :: fetch_array()
in this code i get the error: Fatal error: Call to undefined method mysqli_stmt::fetch_array()
出什么问题了?
$search= "player";
($sql = $db->prepare('select job from jobs where job like ?'));
$sql->bind_param('s', $search);
$sql->execute();
$sql->bind_result($search);
$data = array();
while ($sql->fetch_array(MYSQLI_ASSOC)) {
$data[] = array(
'label' => $row['job']
);
echo json_encode($data);
}
$sql -> close();
$db -> close();
谢谢
推荐答案
使用准备好的语句,没有fetch_array()
.请使用mysqli_stmt::fetch()
代替,或者使用mysqli_stmt::fetchAll()
来获取多个记录
检查手册: mysqli_stmt :: fetch()或 mysqli_stmt :: fetchAll()
Using prepared statements there is no fetch_array()
. Use mysqli_stmt::fetch()
instead or to fetch multiple records use mysqli_stmt::fetchAll()
Check the manual: mysqli_stmt::fetch() or mysqli_stmt::fetchAll()
这篇关于致命错误:调用未定义的方法mysqli_stmt :: fetch_array()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文