I\'m familiar with some of the basics, but what I would like to know more about is when and why error handling (including throwing exceptions) should be used in PHP, especia
Unhanded errors stop the script, that alone is a pretty good reason to handle them.
Generally you can use a Try-Catch block to deal with errors
try
{
// Code that may error
}
catch (Exception $e)
{
// Do other stuff if there's an error
}
If you want to stop the error or warning message appearing on the page then you can prefix the call with an @ sign like so.
@mysql_query($query);
With queries however it's generally a good idea to do something like this so you have a better idea of what's going on.
@mysql_query($query)
or die('Invalid query: ' . mysql_error() . '
Line: ' . __LINE__ . '
File: ' . __FILE__ . '
');