My setup is: codeigniter+postgresql.
Here is an example from official CI user guide about using Transactions :
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');
$this->db->trans_complete();
My transaction returns a value (INSERT ... RETURNING some_id). Question: how can I assign this some_id to a variable in php (CI)?
Just like you would for a SELECT query - call result()
on the object returned by query()
.
Transactions are irrelevant to this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.