Store produre is not getting connection for running another query


I am using mysql version in codeigniter and applied stored procedure for one of database operation and after running this . i want to run another query . so how can i run other query below the store procedure or close the connection

getting this error

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

here is additional code

This is my store procedure

$ret = $CI->db->query("call test_type($item_id$test_id)");  now I want to run this query  $query = $CI->db->query("SELECT * FROM testing WHERE testing.test_type in ('" . $test_id . "') AND testing.test_item_id = '" . $item_id . "' ORDER BY testing.test_date DESC LIMIT 1");  

Thanks in advance


Try this.

Reference link.I am also facing error like you and solved using below code.

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

$sql = $this->db->query("CALL getCityList()");  $result = $sql->result();
//add this two line   $sql->next_result();   $sql->free_result();   //end of new code
return $result;