Jump to content


MySQL Problem

  • Please log in to reply
1 reply to this topic

#1 KyrinComaBlack

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 January 2006 - 01:25 AM

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
$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);
        print("That Username is already takin' please select a new username<br>\n");
            print("E-Mail is already in use please use a different email<br>\n");
            $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')");

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 29 January 2006 - 06:50 PM

Sounds like mysql_fetch_row() isn't returning what you expect -- why not check the actual number of rows with mysql_num_rows() instead?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users