2015-12-06 48 views
0

我如何获得带准备语句的mysqli_fetch_array?我试过fetch_assoc(),但我总是得到一个错误,告诉我没有定义fetch_assoc()。我如何使它工作?我们需要找到$row数组。带准备语句的mysqli_fetch_array

回答

1

你必须安装MySQLND才能做到这一点。 mysqli准备好的语句本身不会生成mysqli_result对象。您需要使用get_result

$stmt->execute(); 
$result = $stmt->get_result(); 
if($result->num_rows == 1){ 
    $row = $result->fetch_assoc();