NO.
Avoid that at all cost!
- It's a horrible message to show an end user
mysql_error
may expose information you don't want to be given
- There is no way to handle the error, i.e revert.
Imagine a database of transactions - your customer sends money, so you have to modify two tables (two queries).
First one transfers money from X to Y and succeeds.
The second one has to subtract Y from X fails.
You have no way to revert the transaction and the error is not logged. Effectively making user Y happy and X left confuse where the money went...
Use a sensible error handling for queries - either make a class that will handle that for you or use ORM.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…