Returning an Error from MySQL
Thursday June 8, 2006
When you are connecting to MySQL from PHP, it is a good idea to include a die error so if something doesn't work, you are given a clue of what went wrong. If no error is encountered the script will run as normal, you only receive feedback when there is a problem. It's always a good idea to include mysql_error () as a precautionary measure.


For tutorial purpose examples seems to be fine, but I will encourage users not to use such structure in a production level application as using die(mysql_error()) will expose your actual error string to browser directly and that string may contain sensitive information also