$r = mysql_query($sql);
if (! $r) {
$error = mysql_error( );
error_log('[DB: query @'.$_SERVER['REQUEST_URI']."][$sql]: $error");
} else {
// process results
}
You're not getting all the debugging help you could
be if you simply log that an error occurred without any supporting
information: