codeigniter : Commands out of sync; you can’t run this command now

add following code into /system/database/drivers/mysqli/mysqli_result.php

 function next_result()
 {
     if (is_object($this->conn_id))
     {
         return mysqli_next_result($this->conn_id);
     }
 }

then in model when you call Stored Procedure

$query    = $this->db->query("CALL test()");
$res      = $query->result();

//add this two line 
$query->next_result(); 
$query->free_result(); 
//end of new code

return $res;

Leave a Comment