1

I am developing a PHP application and making a call to two stored procedure consecutively. When I am trying to do it giving the following error

     Command out of sync; you can't run this command now

I checked some solution and added the store_result() function but for now flagging another error is coming

     Call to undefined method mysqli_result::store_result()

Here a sample code of my application

        $sql         = "CALL get_count_posttype('POST')";
        $result      = $conn->query($sql);
        $postCount   = $result->data_seek(0);

        #i tried to use the following as some post suggested
        #i am getting the following error
        #Call to undefined method mysqli_result::store_result()
        //$result->store_result(); 
        //$result->free_result();

        $sql         = "CALL get_postview_for_admin($offset,$recLimit,'POST')";

        $result      = $conn->query($sql);

        # SQL error : Commands out of sync; you can't run this command now

        #current PHP Version 5.5.9
made_in_india
  • 2,109
  • 5
  • 40
  • 63
  • Do you have the MYSQLND driver installed? This method requires it. – Barmar Apr 24 '14 at 10:38
  • @Barmar : I followed the this post http://stackoverflow.com/questions/1475701/how-to-know-if-mysqlnd-is-the-active-driver `$mysqlnd = function_exists('mysqli_fetch_all'); if ($mysqlnd) { echo 'mysqlnd enabled!'; }` It is showing enabled. – made_in_india Apr 24 '14 at 11:04
  • I know this post is from a while ago, but it seems using `store_result()` with `query()` doesn't work. You need to prepare and execute the statement instead. – J Young Aug 01 '14 at 18:48

0 Answers0