CodeIgniter Forums
mysql database error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: mysql database error (/thread-18929.html)



mysql database error - El Forum - 05-22-2009

[eluser]Arun Joshi[/eluser]
I am using mysqli and stored procedure for my database actions in code igniter. But some times I got an error,

Code:
Error Number: 2014

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



As suggestions from CI forums I have modified the file 'system/database/drivers/mysqli/mysqli_driver.php'.

I changed _execute($sql) function to

Code:
function _execute($sql)
        {
          @mysqli_free_result($this->result_id);
        
   $sql = $this->_prep_query($sql);

   // get a result code of query (), can be used for test is the query ok
   $retval = @mysqli_multi_query($this->conn_id, $sql);

   // get a first resultset
   $firstResult = @mysqli_store_result($this->conn_id);

   // free other resultsets
   while (@mysqli_next_result($this->conn_id)) {
      $result = @mysqli_store_result($this->conn_id);
      @mysqli_free_result($result);
   }

   // test is the error occur or not
   if (!$firstResult && [email protected]_errno($this->conn_id)) {
       return true;
   }
   return $firstResult;
    }


Now my problem has solved.

Actually is this the permanent solution? Is there any CI method to solve this issue? I dont like to take risk on this problem. Please answer...


mysql database error - El Forum - 05-22-2009

[eluser]Jagar[/eluser]
That error message you're getting is a database error. Take a look at this page http://bugs.mysql.com/bug.php?id=28530 and see if that helps, it looks like a bug