try {
mysql_query("INSERT xyz");
mysql_query("INSERT xyz");
mysql_query("INSERT xyz");
commit()
} catch (Exception $e) {
rollback()
}
I would like so that if any of the queries within the try { } fails, to go to the exception and rollback the transaction, and commit otherwise. What kind of things will it throw an exception for I.E if database is down? etc.
Another thing I've noticed is if something is rolledback, then a new record is made the primary key seems to have auto incremented twice, is this something that can be avoided somehow, or are tables which contains rows like (1, 2, 4, 7) for example bad to have as Primary Keys for any reason?
If someone could offer some advice on these issues it'd make me very happy :)