mysql_query returnes either a result set resource, on success, or false on failure. You should always check for success/failure when performing queries, and this also gives you the possibility of getting useful debug information.
$q = 'this is garbage';
$result = mysql_query($q);
if (!$result)
{
echo mysql_errno() . ': ' . mysql_error() . '<br/>' . $q;
}
else
{
# success
}
echo or error_log as needed, although never display errors in production, just in test environment. Also, it's possible that you can live with errors for some queries, while you should die/exit on errors for other queries (such as validating user for login purposes).