CodeIgniter Forums
Calling multiple stored procedures - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Calling multiple stored procedures (/showthread.php?tid=78207)



Calling multiple stored procedures - iot - 12-14-2020

my model has two methods call two different stored procedures:
PHP Code:
function call_1($parameter)
{
    
$sql    "CALL my_procedure_1(?);";
    
$paras  = array($parameter);
    
$query  $this->db->query($sql$paras);
    
$result $query->getResult();
    
$query->free_result(); 

    return 
$result;
}

function 
call_2($parameter)
{
    
$sql    "CALL my_procedure_2(?);";
    
$paras  = array($parameter);
    
$query  $this->db->query($sql$paras);
    
$result $query->getResult();
    
$query->free_result(); 

    return 
$result;


In my controller, I call two methods in order. 
PHP Code:
$this->db->call_1($parameter);
$this->db->call_2($parameter); 

However, only the first call was successful. The second call stops the php execution. 
Could anyone please tell me how to solve it?

I used CodeIgniter 4, and there is no problem with my stored procedures script.