Welcome Guest, Not a member yet? Register   Sign In
Rollback all queries after unsaccessfull transaction
#1

[eluser]levani[/eluser]
I have the following queries inside a transaction:

Code:
$this->db->trans_begin();
$query = $this->db->where('id', $user_id)->set('`points`', "`points` + $point", FALSE)->update('users');
$this->db->insert('logs', $logData);
if ($this->db->trans_status() === FALSE)
{
    $this->db->trans_rollback();
}
else
{
    $this->db->trans_commit();
}

The problem is that the second query is still executed even if the first one has failed. For example when I change the table name from 'users' to something else, of course the first query fails but is insert is still made. Is this the correct behavior of transaction?


Messages In This Thread
Rollback all queries after unsaccessfull transaction - by El Forum - 06-03-2012, 08:48 AM
Rollback all queries after unsaccessfull transaction - by El Forum - 06-03-2012, 11:03 AM
Rollback all queries after unsaccessfull transaction - by El Forum - 06-03-2012, 11:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB