here is a function, to check if the selected entry is in the database:
<?
//here comes the connection to the database:
function check_data($content,$table,$field)
{
$sql="SELECT * FROM $table WHERE $field='".mysql_real_escape_string($content)."'";
if (mysql_num_rows(mysql_query($sql))>0)
return(true);
else
return(false);
}
if(check_data($_POST["username_from_the_form"], "users_table", "username_field")==true)
print "This username is already in the table...";
else
{
print "This username isn't in the table...";
//lets do something in that case...
}
?>