Welcome Guest, Not a member yet? Register   Sign In
execute mysql stored procedures with CodeIgniter
#18

[eluser]mooooo[/eluser]
NOTE! I fixed it by simple fetching the second empty result set from the stored procedure call.

In system/database/drivers/mysqli/mysqli_result.php I added the following function:

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

...and in my model I simple did $result->next_result(); after the stored procedure call.

My issue is shown below

- - - - - - - -


Hi,

I have a issue connected to this thread. I'm using stored procedures with MySQLi and the procedure is working splendid. My problem is when I try to make another standard SQL query. I get the following error:

Code:
Error Number: 2014
Commands out of sync; you can't run this command now

Below are my two model functions:
Code:
function get() {
    $startdate = date('Y-m-d');
    $enddate = '2010-10-01';
    $query = 'CALL get_calendar("?", "?")';
    $result = $this->db->query($query, array($startdate, $enddate));
    return $result->result_object();
}
    
function unavailable_weeks() {
    $query = 'SELECT * FROM weeks_unavailable';
    $result = $this->db->query($query);
    return $result->result_object();
}

I'm running these from my controller like so:
Code:
function index() {
   $data['dates'] = $this->week->get();            
   $data['unavailable'] = $this->to_array($this->week->unavailable_weeks(), 'id', 'week');
   $this->render('index', 'Välj veckor', $data);
}

$this->render and $this->to_array are custom functions but this is just to show the calls to the model.

Does anyone know how to solve this?

Regards,
Niklas[/b]


Messages In This Thread
execute mysql stored procedures with CodeIgniter - by El Forum - 02-08-2008, 01:23 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-09-2008, 11:06 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-26-2008, 04:50 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-26-2008, 05:23 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-26-2008, 03:25 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 04-16-2008, 03:48 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 04-16-2008, 07:45 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 04-22-2008, 04:00 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 04-22-2008, 10:47 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 08-06-2008, 07:50 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 10-16-2008, 03:17 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-25-2009, 06:58 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 11-05-2009, 01:05 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 12-17-2009, 01:18 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-21-2010, 01:26 PM
execute mysql stored procedures with CodeIgniter - by El Forum - 02-28-2010, 04:18 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 04-21-2010, 01:25 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 08-22-2010, 04:15 AM
execute mysql stored procedures with CodeIgniter - by El Forum - 01-23-2011, 05:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB