// You can query the DB against a unique key...
$qry = mysql_query("SELECT * FROM table WHERE uniqueID = '$uniqueid'");
// Then count the # of rows returned...
$count_qry = mysql_num_rows($qry);
// Then run an if/else to do whatever you want based on the count.
IF($count_qry == 0):
// This is what you do if the row doesn't exist based on the count
ELSEIF($count_qry == 1):
// This is what you do if the count = 1
ELSE:
// Do this if your count returns more than one row (which shouldn't happen if you are working with a unique ID key.)
ENDIF;