Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DotGeek:
Error Checking and Handling
Jan 26, 2004 @ 13:09:01

Well, it looks like DotGeek.org is back up and already going with new content this week, including one of their latest dealing with error checking and handling in your PHP scripts.

In this new piece, they cover something that many programmers leave out of their scripts - code to catch and handle errors that might be thrown. The example they give is simple, but it gets the point across. The normal input of the form would lead to a successful result, but incorrect information could make the script stop in its tracks and blow up in the user's face with a standard PHP error. Being that these errors are a bit cryptic (at best), most users would be frustrated and either leave or get upset at the site. They suggest something as some if loops to ensure that the user has filled in all of the correct info. This way, you can catch the problems long before they hit your database.

Of course, this code is just the beginning of handlling errors. There are even functions in PHP to help you set up a defualt error handler for your entire site, making it even easier to handle and report errors that the users might be seeing...

tagged:

Link:


Trending Topics: