instead of 'and' use '&&'

if($line[1] == "$bruker" && $line[2] == "$passord"){
        echo "hei $bruker.";
}else{
        echo "FEIL";
}

Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Email : [EMAIL PROTECTED]


-----Original Message-----
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 8:25 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] why doesnt this work???


You need two = signs for comparision not just one .
Also I think you need to enclose the variables in double quote.

       if( $line[1]=="$bruker" and $line[2]=="$passord")  echo "hei
$bruker.";
         else echo "FEIL";


> -----Original Message-----
> From: chris [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 20, 2002 8:15 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] why doesnt this work???
>
>
> this script receives vars "b" and "p" from a form.
> If "b" and "p" matches the echo on IF, then it works just fine.
> The problem is that if the vars dont match the ELSE ECHO
> does not apear... why not?
>
> <?
> $bruker = $HTTP_POST_VARS["b"];
> $passord = $HTTP_POST_VARS["p"];
> $hostname = "********";
> $username = "********";
> $password = "********";
> $dbname = "********";
> MSSQL_CONNECT($hostname,$username,$password);
> mssql_select_db($dbname);
> $query = "select * from medlemmer where bruker = '$bruker' and passord =
> '$passord'";
> $result = mssql_query( $query );
> for ($i = 0; $i < mssql_num_rows( $result ); ++$i)
>      {
>
>       $line = mssql_fetch_row($result);
>       if( $line[1]='$bruker' and $line[2]='$passord')  echo "hei
$bruker.";
>          else echo "FEIL";
>      }
> ?>
>
> -Chris
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to