In the php script if my query is incorrect, exit the program with a die. M开发者_StackOverflow社区y question is, if they are in the middle of a transaction, that it will end? Will run an implicit ROLLBACK?
mysql_query('BEGIN'); mysql_query('UPDATE ...'); mysql_close();
in this case behaves like mysql? and using persistent connections? (http://www.php.net/manual/en/function.mysql-pconnect.php#33994)
The MySQL engine will rollback transactions when errors occur, or if the session closes for any reason before commit. Only committed transactions are persisted. See the transaction documentation for more details.
It's depend on how you are performing transaction from PHP side.
If you are using simple mysql_query
function to run each transaction statement separately and if any query fails the transaction never rollback.
If you are creating transaction in stored procedure and calling that stored procedure from PHP. The changes will be rolled back if any query fails in transaction.
if your QUERY is wrong and not executed then nothing will be changed in your tables..dont worry
精彩评论