duangang2825
duangang2825
2014-05-02 10:10

mysqli_stmt :: get_result()调用undefined [duplicate]

已采纳

This question already has an answer here:

I am changing all my scripts to prepared statements with mysqli and I have a problem. I get this error when I use get_result() and I don't know why. My php version is 5.3.

Here is the code I use:

$user=$_GET['user'];
$stmt = $dbc->prepare("select * from `users` where id= ? and stare!=1"); 
$stmt->bind_param('s', $user);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {

//do something

}

Error:

Call to undefined method mysqli_stmt::get_result() in /home/websoft/public_html/twingoo/engine/app/profil_edit.php on line 13
</div>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dragon5006 dragon5006 7年前

    I encountered this problem recently.

    You need to make sure that the mysqlnd extension is installed for that particular part of mysqli to work.

    Depending on if you are using Windows or Linux (and what flavor of either) will determine how this is done.

    In CentOS, it is pretty straight-forward :

    yum install php-mysqlnd
    

    And to confirm it is installed, you can create a php page with the following :

    <?php
    phpinfo();
    ?>
    

    Then look for mysqlnd or native

    You can also validate it is installed by

    php -m | grep mysqlnd
    

    OR

    php -i | grep mysqlnd
    
    点赞 评论 复制链接分享

相关推荐