RE: [PHP] Matching Question
| From: | Jeff Oien | Date: | Sat, 04 Aug 2001 21:08:26 +0000 |
| Subject: | RE: [PHP] Matching Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61271@lists.php.net to get a copy of this message | ||
Thank you. That worked and I'm sure will have made it work a lot
faster later on when there is a lot of data in the database.
Jeff Oien
> On Sat, 4 Aug 2001 12:40:42 -0500, Jeff Oien (jeff@webdesigns1.com)
> wrote:
> >After a sign up page I want to check if someone is already entered
> >into a database. The First Name, Last Name and Address all have
> >to match exactly in order for it to be considered a duplicate.
> >However
> >this isn't doing what I want. I get the Error produced if the
> >Address matches
> >but the name doesn't. Not sure what I'm doing wrong. Thanks.
> >Jeff Oien
>
> you're going about this the wrong way.
> try it like this:
>
> $result=mysql_query("select * from table where first='$first' and
> last='$last' and address='$address'");
>
> if(mysql_num_rows($result)){
> // error code
> }
>
> you want to keep the result sets that mysql gives back as small as
> possible because they take up tons of resources.
>
> >while ($row = mysql_fetch_array($result)) {
> > $First_Name = $row['First_Name'];
> > $Last_Name = $row['Last_Name'];
> > $Address = $row['Address'];
> >
> > if (($M_First_Name || $F_First_Name == $First_Name) &&
> > ($M_Last_Name || $F_Last_Name == $Last_Name)
> > && ($Address1 == $Address)) {
> > echo "
> > <html><head><title>Error</title> </head>
> > <body bgcolor=\"#FFFFFF\" text=\"#000000\"
> >link=\"#0000ff\"
> >vlink=\"#660099\">
> > <h3>Error</h3>
> >etc...
> >
> >--
> >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
>
>
>
> --
> 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
>