[thelist] MySQL/PHP DWMX Duplicate Entry Error Question

Liam Delahunty ldelahunty at britstream.com
Sun Nov 3 15:46:00 CST 2002

Phil Parr wrote:

>I'd like to be able to display a message like "Sorry - this email
>address is already in use" and provide a link back to the form.

On submit (and after any form validation) just look up the email address
from the table...

$query = "SELECT email FROM that_tbl WHERE email = '$email' ";
$num_rows = mysql_num_rows($result);
if ($num_rows) {
	print ("Sorry - this email address is already in use");
	} else {
	$query = "INSERT INTO .... ";
	$result = mysql_query($query, $connection);

Kind regards,
Liam Delahunty
Mega Products Limited, http://www.britstream.com/
Hosting/ Domain Names From UKP 7.50 p.a.
web/ design/ database/ programming

More information about the thelist mailing list