Ok, so I'm trying to build my first PHP project, but was having problems with the user sign up section of code.
When someone goes to sign-up, my page will check to make sure that the required fields aren't empty, and that they contain encrypted and cleaned up data for the MySQL database. Most importantly, I wanna make sure that an error is sent to the user if there is a duplicate user name. I wan't the same to occur if there is a duplicate email address.
1st, connect to DB
2nd, select DB
3rd, query the user and email fields
4th, make sure there is no match in the user field from what's in $REQUEST['user']
make sure there is no match in the user field from what's in $REQUEST['email']
(Sorry, I don't have my code with me to post 🙁 )
How do I check to make sure there are no duplicates entered in the database for user and set an error variable to echo later? I tried a loop, but it echo's the error for each cycle through the loop. I tried in_array() to search for just that one occurence using the $_REQUEST variable as the needle but PHP didn't like that idea.
I'm stuck at a logic wall 🙁