Not sure of your scripting language, but this logic should work.  Just
apply it to each web_form variable posted.

Select count(*) as number FROM table WHERE field=value_from_web_form

If number==0 then .... do your inserts
Else
Echo "Sorry, field=value_from_web_form data already exists.";
Reset form



Andrew Hazen


-----Original Message-----
From: Tech @NorthWeb [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, May 02, 2002 9:32 AM
To: mysql
Subject: Fw: data compare and duplicate entries..

hi,
I was looking for an SQL statement or script that whould allow me to
compare
data when it was entered into a mysql-php field on a web page so that it
checks whether the data entered has not been used before in the
database..
In short, when data needs to be entered, the statement/script must check
in
the database whether the data is not already entered into the database
and
if its there, return with an error.. and not allow the data to be
entered...
if the data is not there, then it may be entered..

Thanx
Willem Pretorius


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to