How do I test if my MySQL query was successful

or

or

also(much better)

A better solution I’ve found is to manage the difference between an ERROR and 0 affected rows. 0 affected rows is not necessarily a bad thing, but an error is something you do want to know about:

Now your function can differentiate…

Just some quick hacking there – you should obviously make the code far more verbose if you have other people using it.

The point is, consider using _error_message to differentiate between 0 updated rows and a real problem.