code:$result = mysql_query etc
code:if (!$result){die('Invalid query: ' . mysql_error() . "<br>SQL: " . $sql);}