Jump to content

MySQL Problem


KyrinComaBlack

Recommended Posts

ok I got it working and everything. Now i'm getting a problem. Ok I created a user and all and it gets put in the table. Then I test out the checking and if says Email is been sent but I just added the same user again :S

heres the code
[code]
$user_check_sql = mysql_query("SELECT username FROM user WHERE username='$username'") or die(mysql_error());
    $email_check_sql = mysql_query("SELECT email_address FROM user WHERE email_address='$email'") or die(mysql_error());

    $user_check = !mysql_fetch_row($user_check_sql);
    $email_check = !mysql_fetch_row($email_check_sql);
    
    if($user_check){
        print("That Username is already takin' please select a new username<br>\n");
    }else{
        if($email_check){
            print("E-Mail is already in use please use a different email<br>\n");
        }else{
            $q = mysql_query("INSERT INTO user (username, password, email_address, city, state, country, gender, month, day, year)
                              VALUES('$username', '$password', '$email', '$city', '$state', '$country', '$gender', '$month', '$day', '$year')");
        }
    }
[/code]
Link to comment
https://forums.phpfreaks.com/topic/3273-mysql-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.