Welcome Guest, Not a member yet? Register   Sign In
Transactions. Which query failed?
#1

[eluser]srisa[/eluser]
Hello,

I plan to use transactions with db_debug turned off.
Code:
$this->db->trans_start();
$this->db->query('query1');
$this->db->query('query2');
$this->db->query('query3');
$this->db->trans_complete();
Assuming that one of the three queries have failed, is there anyway to know which query failed and what the error message was?

I tested it out with 3 queries, where queries 1 and 3 succeed and query 2 fails. I tried to get hold of the query with following code but it is returning the last query , query 3 (which succeeds if executed)
Code:
if ($this->db->trans_status() === FALSE)
{
    echo 'Query that failed was '.$this->db->last_query().'<br />';
    # above line is returning query 3
}
So, is there a way to get hold of the query that failed using the transactions in the above mentioned manner?

Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB