Re: why doesnt this work???

From: Date: Thu, 21 Mar 2002 05:39:22 +0000
Subject: Re: why doesnt this work???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89460@lists.php.net to get a copy of this message
Hi Try this: $query = "select * from medlemmer where bruker = '$bruker' and passord ='$passord'"; $result = mssql_query( $query ); while($line = mssql_fetch_row($result)):
      if( $line["bruker"] == $bruker && $line["password"] == $passord)  echo "hei $bruker.";
     else echo "FEIL";
endwhile; Tom At 12:14 AM 21/03/2002, chris wrote:
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


« previous php.general (#89460) next »