I'm working on a script that handles a member sign up. Upon submission of new member info the script queries the users table to check for duplicate user name (in this case an email) and return an error if duplicate is found. If not I want it to just submit the original new member info. The check for duplicates executes okay, but INSERT new info does not.
$sql = "SELECT * FROM users WHERE username = '{$email}' " ;
$result = mysql_query($sql);
if ( mysql_num_rows ( $result ) > 0 )
{
// Username already exists
echo 'That Email is already in use.' ;
exit;
}
else
{
$sql = "INSERT INTO users (username, password, first_name, last_name) VALUE ('$email', '$pw', '$fname', '$lname')";
echo "Thank you for becoming a member ". $fname . "!";
}
I thought that maybe assigning a different variable to the INSERT query would work but I had no luck. Also tried to free $results and that didn't work either.