Very true,
but what makes it even eaier is to use the mysql error reporting.
That will tell you exactly at what point mysql found a problem.
For example:
if (!($result=mysql_query($sql_statement,$db_connection)))
{
Query failed, report error
print mysql_errno().": ".mysql_error()."\n";
}
else
{
Query ok, process output
};