我正在使用 mysqli 执行选择查询...
/** ------------ queries ---------- **/
$stmt = $mysqli->prepare("SELECT * FROM dept");
if(! $stmt)
{
echo "statement not prepared well";
}
else
{
echo $mysqli->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
// add else
else{
echo "Query is successfully executed but no result fetch";
}
if (!($res = $stmt->get_result())) {
echo "Getting result set failed: (" . $stmt->errno . ") " . $stmt->error;
}
/** ------------------------------- **/
#------result ----
var_dump($res->fetch_all());
#---------(/result)----
我的问题是 execute() 工作正常,但无法获取记录...该表中有大量数据...它显示“查询已成功执行但未获取结果”以及之后Fatal error: Call to undefined method mysqli_stmt::get_result()
我究竟做错了什么 .. ?