CodeIgniter active records' problems calling multiple stored procedures CodeIgniter active records' problems calling multiple stored procedures codeigniter codeigniter

CodeIgniter active records' problems calling multiple stored procedures


The problem is related to CodeIgniter's active recors and multiple database stored procedure calling.

First of all check that dbdriver parameter (application/config/database.php) is set to mysqli.Then, as described in "Calling a stored procedure from CodeIgniter's Active Record class" question on StackOverflow, adding to system/database/DB_active_rec.php the following function:

function freeDBResource($dbh){    while(mysqli_next_result($dbh)){            if($l_result = mysqli_store_result($dbh)){              mysqli_free_result($l_result);            }        }}

..And in your controller use:

$this->db->freeDBResource($this->db->conn_id);

after any stored procedure calling.


Model and Controller seems to be ok.If you try a model like:

class Test_model extends CI_Model{   function __construct()   {      parent::__construct();   }   function a($a_input)   {      return($a_input.': a');   }   function b($b_input)   {     return($b_input.': b');   }}

...And call it functions from a controller like this:

$this->load->model('Test_model');    $a_result = $this->Test_model->a('aaa');    $b_result = $this->Test_model->b('bbb');    echo($a_result.'<br />'.$b_result);

You can see multiple function calling working fine.

Are you sure you can execute any of three function in model correctly, if you call only one?If yes, maybe the problem can be find in your stored procedures... Can you try to execute a normal query instead of stored procedures, in model functions? For debug your problem, check also in your /application/config/database.php if db_debug is set to TRUE.