1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

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.
Comments
September 8, 2009 at 7:40 pm
(1) Zareef Ahmed says:

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

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.