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:
INSERT INTO tbluser
WHERE NOT (
user_loginname = $userLogin AND
user_email = $userEmail))
I get the following error:
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
You'll need to configure the indexes on your table. So the username and email address fields would become unique indexes. When you then attempt to INSERT into the table, an error will be thrown. This can be retrieved using the MySQL error number, and then handed accordingly.
It saves on a SELECT statement to check if it is unique or not.
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.