# get the resource identifier
$result = mysql_query("SELECT * FROM mytable WHERE 1") OR die(mysql_error());
# check how many rows and do something if none
if (mysql_num_rows($result)<1){
# whatever happens if no result
} else {
# other handling etc.