hello people ive got a signup form which allows people to signup and login but to signup they enter there email address in which is then used as there login name, its all working but when the next user signs in they mite type the same email address in so i need the sql statement to search the database and check if that username already exists if it does display a message and then re enter new username, is it some sort of search statement??
aran87
0
Light Poster
Recommended Answers
Jump to Postthis is really easy one.
use this:
//$email is the variable with the email address $sql = "SELECT COUNT(*) FROM `table` WHERE `email` = '" . $email . "'"; $query = mysql_query($sql); $res = mysql_fetch_row($query); $num = $res[0]; if ($num > 0) { //display error } …
Jump to Postpost your code and i will integrate my code for you. it would take to long to explain everything and find the problem.
Jump to Postyou can make that column of the mysql table 'unique'. that will make sure the same username cannot be inserted twice. as for the code you posted, i need the form also so I can see the whole process so I can fix it.
All 9 Replies
somedude3488
228
Nearly a Posting Virtuoso
aran87
0
Light Poster
aran87
0
Light Poster
somedude3488
228
Nearly a Posting Virtuoso
aran87
0
Light Poster
aran87
0
Light Poster
somedude3488
228
Nearly a Posting Virtuoso
sukhy_1
0
Junior Poster in Training
somedude3488
228
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.