fai un check sul numero di righe restituito dalla query
codice:
if (mysql_num_rows($result) > 0) { //trovato qualcosa
 ...
 ...
}
else { // non trovato
 ...
}