我以下的PHP MYSQLi无法正常工作,PHP 5.9版
$query = $conn->prepare("SELECT * FROM users WHERE token= ? LIMIT 1");
$query->bind_param('s',$cvalue);
$query->execute();
$result = $query->get_result();
$row = $result->fetch_assoc();
它给我以下错误:
致命错误:调用未定义方法mysqli_stmt :: get_result()
错误在哪里?我该如何解决?谢谢
这个评论太长了。
试试这个:
if($statement=$conn->prepare("SELECT * FROM users WHERE token= ? LIMIT 1")){
$statement-> bind_param('s',$cvalue);
// Execute
$statement-> execute();
// Bind results
$statement-> bind_result($token);
// Fetch value
while ( $statement-> fetch() ) {
echo $token . "<br>";
}
// Close statement
$statement-> close();
}
// Close entire connection
$conn-> close();
现在,如果while ( $statement-> fetch() )
无法正常运行,请尝试以while ( $statement-> fetch_assoc() )
现有方式替换为。
脚注:
火箭在核生化事故的注释说,我引用:它需要两个PHP 5.3+和的mysqlnd驱动程序。
因此,请确保已安装驱动程序。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句