Re: Database duplicates

From: Date: Fri, 17 Nov 2000 00:14:57 +0000
Subject: Re: Database duplicates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25825@lists.php.net to get a copy of this message
Why not do something like this before you do an insert.... select count(*) from your_table where phonenumber='$phonenumber' and areacode='$areacode' Then if the value returned from that query is greater than zero you know that information already exists. - Jamie > I'm sifting through the archives right now > and can't find anything for my specific problem > I brought this up a week or two ago, but am still > in a similar spot. I'm adding regional dialup numbers > to a MySQL DB and I want to reduce the possibility of > redundant data I've got fields for ID, city, state, state abbreviation, > area code, phone number and services. I've got the ID set to primary > I can't really use the number as primary since potentially there > will be the same numbers somewhere albeit a different area code. I > just need to know how to stop myself from reentering things that are already > in the DB... > if($phoneNumber == $phonenumber) > { > echo "alert(quit it)"; > } > something like that?

« previous php.general (#25825) next »