Re: Whats wrong with this code?
| From: | David Robley | Date: | Tue, 17 Jul 2001 03:23:57 +0000 |
| Subject: | Re: Whats wrong with this code? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58168@lists.php.net to get a copy of this message | ||
On Tue, 17 Jul 2001 12:37, Brad Wright wrote:
> > From: Rasmus Lerdorf <rasmus@php.net>
> > Date: Mon, 16 Jul 2001 19:56:29 -0700 (PDT)
> > To: Brad Wright <bradwright@optushome.com.au>
> > Cc: PHP General List <php-general@lists.php.net>
> > Subject: Re: [PHP] Whats wrong with this code?
> >
> >> Hi all, Im getting mighty frustrated with this peice of code. It
> >> checks the first condition no probs, but the second IF statement
> >> doesnt work. So it will stop if it finds a du[plicate login, but
> >> cannot find duplicate passwords. the $num_rows2 variable always gets
> >> the value '0' even when there is an existing password the same as
> >> the new user-entered value.
> >>
> >> $result = mysql_query("SELECT * FROM Login_TB where
> >> Login='$Login'",$db) or die ("ouch");
> >>
> >> $num_rows = mysql_num_rows($result);
> >>
> >> $query2 = "select * FROM Team_Login_TB where Pass =
> >> password('$Pass')"; $result2 = mysql_query($query2,$db) or die
> >> ("ouch2");
> >> $num_rows2 = mysql_num_rows($result2);
> >
> > Your second query must not be returning any rows. Print out $query2
> > and paste the string you see into the command line mysql tool and
> > execute the query. I bet it will return 0 rows.
> >
> > -Rasmus
> Rasmus,
> you are dead right, it is returning 0 rows. I checked that before
> submiytting the original post. Sorry, i should have mentioned it. I
> guess the question is, why is it returning no rows?
This might be too obvious, but are you looking in the correct table? Your
second query searches a different table from the first? Alternatively,
you might be getting something you don't expect in $Pass.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
1200 bps used to seem so fast