Hello,
I created a stored procedure in MariaDB, which works well. Now I wanted to use it in the table_after_insert() hook. I could imagine to do it like this:
$db->query('call insertMaintenance('.$data['ResourceId'].', '.$data['EndDate'].');');
But where does this $db object comes from? Do I have to create a new one or is there still one available from the previous insert operation?
Thank you for pointing me to the right direction.
Olaf
Using stored procedure in a hook
Re: Using stored procedure in a hook
I found the sql()function and tried:
sql("call insertMaintenance('".$data['ResourceId']."', '".$data['EndDate']."')", $error);
But then I'm getting an "out of sync" error. Nevertheless, the data was inserted to the database. How can I avoid this error?
sql("call insertMaintenance('".$data['ResourceId']."', '".$data['EndDate']."')", $error);
But then I'm getting an "out of sync" error. Nevertheless, the data was inserted to the database. How can I avoid this error?
Re: Using stored procedure in a hook
maybe try
Code: Select all
sql("call insertMaintenance('".$data['ResourceId']."', '".$data['EndDate']."')", $o);
AppGini 22.13