on 1/13/02 10:51 AM, Dean Ouellette at [EMAIL PROTECTED] wrote:

> I am entering info from form into database, is there a way to check say
> firstname, lastname and address to see if it is a duplicate to what is
> already in database and if it is then just enter any new information they
> may enter and not create a new entry

i'm definitely not an expert on this stuff, but here are some things to
think about...

on way to keep duplicates from being entered, is to make every (firstname,
lastname, address) triplet unique in your database. in mysql, this would be
something like

 ALTER TABLE table_name ADD UNIQUE some_unique_name(firstname, lastname,
address);

this may not be a good thing though. there may be instances where two folks
exist with the same firstname,lastname, address. father/son and
mother/daughter perhaps.

if you just want to check, you can do something like

 SELECT id FROM table WHERE firstname = '$firstname' and lastname =
'$lastname' and address = '$address';

if you get an id, then a record already exists. the problem with this, is
data entry. depending on who is typing the stuff in a form, they may not
type/spell it exactly the same each time.

you may need to figure out some other unique identifier to determine if it's
the 'same' person.

hope this helps,
mike

 -- mike cullerton 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to