codice:
$testoquery = "SELECT count(*) as tot FROM `tabella` WHERE `id`='$id';"; 
$query = mysql_query($testoquery); 
$array = mysql_fetch_array($query);

if($array['tot'] == 1 ) 
//esiste 
else 
//non esiste