Re: Checking for 2 unique row contents

From: Date: Wed, 27 Mar 2002 22:36:33 +0000
Subject: Re: Checking for 2 unique row contents
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17956@lists.php.net to get a copy of this message
So you have one table with the fields 'email' and 'nickname' (perhaps others too) and and given: $email = 'frank@bar.com' $nickname = 'stinky' You wish to be sure that no other record has either that email _or_ that nickname. Correct? You could run: select * from <table> where email = $email or nickname = $nickname Now this would return rows if either was true and the only way you could tell would be to look at the results and compare those fields to the values you already have. If the results are empty then it's cool - there aren't any rows with these values. Otherwise if you want two results use two queries. Good Luck, Frank On 3/27/02 12:27 AM, "php-db-digest-help@lists.php.net" <php-db-digest-help@lists.php.net> wrote: > From: "Dave Carrera" <dave@davecarrera.com> > Date: Wed, 27 Mar 2002 08:27:21 -0000 > To: <php-db@lists.php.net> > Subject: Checking for 2 unique row contents > > Hi all > > > > I am trying to create a registration area that uses a nickname and email > pair. > > > > I need both to be unique. > > > > So how do I that either do not already exist then if unique insert into > db. > > > > So > > if nickname exist then error = "sorry..." > > if email exist then error = "sorry..." > > else must be unique > > insert. > > > > I have been trying for hours know but cant get the twin check to work. > > > > Can get single check to work though. > > > > I thank you in advance for any thoughts or code examples > > > > Dave Carrera > > Php Developer > > http://davecarrera.freelancers.net > > http://www.davecarrera.com -- Frank Flynn Poet, Artist & Mystic

« previous php.db (#17956) next »