Re: problem using &&
| From: | Jochem Maas | Date: | Wed, 26 Jul 2006 11:22:02 +0000 |
| Subject: | Re: problem using && | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239793@lists.php.net to get a copy of this message | ||
php@redry.net wrote:
> Hi
> I am reading a username and password from a file. For the moment I am trying to test if the
> username and password are the same as user inputted username/password.
> My code snippet is as follows:
> if( $out[0][0] == $u && $out[0][1] == $p ) {
> $error = "Login successful!";
> }
> else {
> $error = "Invalid username/password. Try again";
> }
>
> $out[] is an array containing the file data.
> $u is the form username and $p the password.
> I echo both values once submitted. Even when they match I get invalid username/password
> message.
> If I just test if( $out[0][1] == $u ) it works.
take a REALLY GOOD LOOK at your [compound] if statement
(hint: what are you checking against $out[0][1]?)
> Has anyone any pointers
...
simply that array items don't magically swap places in order to
do what you mean.