Transaction Rollback

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Transaction Rollback

Post by requinix »

Just do everything like normal: check that queries succeed, grab error information if they don't, that kind of thing. Transactions can help you deal with error cases and race conditions but they don't have much else of an impact on your code design.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Transaction Rollback

Post by requinix »

So... do that. I don't see what's preventing you from reporting your own error messages according to however you feel. Maybe you have an example of what you're working with?

Tip: if you mean row numbers like line numbers in your code then use __LINE__.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Transaction Rollback

Post by requinix »

If the query fails, MySQL will not tell you exactly what row caused it to fail. You'll have to figure that out for yourself.

Check your data before you try to do anything. If the data is good then continue, if the data is bad then stop. Since you're the one checking the data you will know exactly why you thought it was bad.
Post Reply