function usercheck ($username) {
    $database = "xxxxx_defter";
    $hostname = "localhost";
    $username = "xxxxx_root";
    $password = 'xxxxxxxx';
    $db=mysql_connect($hostname,$username,$password);
    mysql_select_db($database,$db) or die("Could not select the database!");;
    $check_result = mysql_query("SELECT id FROM uye WHERE uyeadi='".$username."'");
    return mysql_num_rows($check_result);
}
$kadi = $_POST['username'] ;
if (usercheck($kadi) < 1) {
// kayit kodları
} else {
echo "Kullanici adı mevcut";
}