RE: [PHP] Database duplicates

From: Date: Fri, 17 Nov 2000 00:47:08 +0000
Subject: RE: [PHP] Database duplicates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25829@lists.php.net to get a copy of this message
Thank you, that did the trick much obliged Jerry Lake -----Original Message----- From: Jamie Alessio [mailto:alessio@mvfx.com] Sent: Thursday, November 16, 2000 4:15 PM To: Jerry Lake; php-general@lists.php.net Subject: Re: [PHP] Database duplicates 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#25829) next »