Welcome Guest, Not a member yet? Register   Sign In
mysql database error
#1

[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 && !@mysqli_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...


Messages In This Thread
mysql database error - by El Forum - 05-22-2009, 08:59 AM
mysql database error - by El Forum - 05-22-2009, 09:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB