$valor="texto"; $query="select * from tabla where campo='$valor'"; $result=mysql_query($query); if(mysql_num_rows($result)>=1) { echo 'Ya existe'; }