我有以下代码:
$postId = $_GET['postId'];
$mysqli = new mysqli('localhost', 'username', 'database', 'name_db');
mysqli_report(MYSQLI_REPORT_ALL);
$stmt = $mysqli->stmt_init();
$stmt->prepare("
SELECT *
FROM posts
WHERE postId = ?
");
$stmt->bind_param('i', $postId);
$stmt->execute();
$result = $stmt->get_result();//Call to undefined method
$info = $result->fetch_array(MYSQLI_ASSOC);
echo json_encode($info);
Run Code Online (Sandbox Code Playgroud)
我收到上面标记的错误.我做错了什么?
编辑:
将fecth_array()更改为fetch_array()