mysql rollback with php
Moderator: General Moderators
mysql rollback with php
hi, I have a question: How can execute sevelral mysql queries all together or none at all when a query failed? I know mysql have rollback command for innoDB but how can i use it in php?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: mysql rollback with php
In PHP you simply submit SQL queries to the server. Any SQL commands, such as COMMIT and ROLLBACK, work the same as they do from the command line.
(#10850)
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: mysql rollback with php
PHP supports mysql transactions. Just be sure to turn autocommit to falsenga wrote:hi, I have a question: How can execute sevelral mysql queries all together or none at all when a query failed? I know mysql have rollback command for innoDB but how can i use it in php?
http://us3.php.net/manual/en/mysqli.rollback.php