[eluser]jvicab[/eluser]
$this->db->trans_begin();
// execute first query here
// check the result:
if ($this->db->trans_status() === false) {
// error, so rollback changes and exit:
$this->db->trans_rollback();
return array('error' => $this->db->_error_message());
}
// repeat the above for each query inside the transaction
// if no error: commit the transaction:
$this->db->trans_commit();
One note: the type of the tables involved in the queries should support transactions, line InnoDB. MyISAM does not support transactions