View Single Post
Old 06-24-2009, 04:55 AM   #1 (permalink)
rguy84
The Contributor
 
Join Date: Jun 2009
Location: Seattle, WA
Posts: 76
Thanks: 1
rguy84 is on a distinguished road
Default Check that values aren't the same

I am playing around (locally). I want to make up a sign up form for this cms-like thing I am building. I want to make sure that the user login and e-mail aren't in the db already.

My SQL Statement is:
Code:
INSERT INTO tbluser 
 (user_loginname, 
  user_pass,
  user_firstName,
  user_lastName,
  user_email)
 VALUES(
  $userLogin,
  $userPass,
  $userFirst,
  $userLast,
  $userEmail)
 (SELECT user_loginname, 
  user_email
  FROM tbluser
  WHERE NOT ( 
  user_loginname = $userLogin AND 
  user_email = $userEmail))
I get the following error:
Quote:
Could not add: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@yahoo.com)(SELECT user_loginname, user_email FROM tbluserWHERE NOT ( user_login' at line 1
Any hints?
__________________
Ryan | Blog | Twitter
Send a message via AIM to rguy84 Send a message via MSN to rguy84 Send a message via Yahoo to rguy84 Send a message via Skype™ to rguy84
rguy84 is offline  
Reply With Quote