So I'm working on my registration process of pset7. What's the best way to make sure that an e-mail address can only be used for one account?
In my php controller I use this sql query to check if the email address is already used in my users database.
/* check if email is already used */ $search = query("SELECT * FROM users WHERE email='?' ", $_POST["email"]); if ($search == 1) apologize("Email address is already used");
It happens that $search always contains 0, even if I entered an email adress that is already used by another user.
The SQL statement SELECT * FROM users WHERE firstname.lastname@example.org' does return a row if the email address is found in the database...
How could I get this to work? Is it better to make the email column unique? which setting would I need to change?