PHP registration script: verifying and telling the user what went wrong
Posted
by Maxime
on Stack Overflow
See other posts from Stack Overflow
or by Maxime
Published on 2010-06-01T21:42:31Z
Indexed on
2010/06/01
21:53 UTC
Read the original article
Hit count: 235
Hi,
I'm building a registration script and I want to insert the user's input (username, mail) ONLY if it's not already in the database. What I usually do in such cases is a request to see if something's already there, something like: "SELECT * FROM things WHERE thing_name = '$treated_user_input'".
I have two fields that need to be unique this time though. Is there a way to do only one SELECT request and still be able to tell the user exactly what field went wrong? Or do I have to do one request per unique field?
Thanks for your answers.
© Stack Overflow or respective owner