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

[eluser]CoreyLoose[/eluser]
I wasn't able to get any of the solutions given here to work for me, but I was able to get a hybrid approach to work.


database.php
Code:
$db['default']['dbdriver'] = "mysqli";


query
Code:
$this->load->helper('mysqli');

$result = $this->db->query( 'CALL MyProc(?)', array($parameter) );
print_r( $result->result_array() );

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


mysqli_helper.php
Code:
function clean_mysqli_connection( $dbc )
{
    while( mysqli_more_results($dbc) )
    {
        if(mysqli_next_result($dbc))
        {
            $result = mysqli_use_result($dbc);
            
            if( get_class($result) == 'mysqli_stmt' )
            {
                mysqli_stmt_free_result($result);
            }
            else
            {
                unset($result);
            }
        }
    }
}

Until I started using the clean_mysqli_connection function I was getting an error along the lines of 'Commands out of sync; you can't run this command now' whenever I tried to call a procedure a second time.


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