$result = mysql_query("SELECT * FROM check WHERE korime = '$username'"); if(mysql_num_rows($result) > 0){ .... }