RE: [PHP] why doesnt this work???
| From: | Stampe, Lars | Date: | Wed, 20 Mar 2002 14:42:50 +0000 |
| Subject: | RE: [PHP] why doesnt this work??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89339@lists.php.net to get a copy of this message | ||
Please try this :)
for ($i = 0; $i < mssql_num_rows( $result ); $i++)
{
$line = mssql_fetch_row($result);
if (($line[0] == $bruker) && ($line[1] == $passord))
{
echo "hei $line[0]";
}
else
{
echo "FEIL";
}
Lars Stampe
-----Original Message-----
From: Rick Emery [mailto:remery@excel.com]
Sent: 20 March 2002 14:30
To: 'chris'; php-general@lists.php.net
Subject: RE: [PHP] why doesnt this work???
First: you need == not = to test equivalence.
Second, use " not '; otherwise $vars will not expand
if( $line[1]=="$bruker" and $line[2]=="$passord")
{echo "hei $bruker.";}
else {echo "FEIL";}
-----Original Message-----
From: chris [mailto:tometerlaks@hotmail.com]
Sent: Wednesday, March 20, 2002 8:22 AM
To: php-general@lists.php.net
Subject: Re: [PHP] why doesnt this work???
nope... that did not do the trick...
-Chris
"Rick Emery" <remery@excel.com> wrote in message
news:EAA093B474ABD311A71E00508B5FE08305C2D328@adntex03.us.excel.com...
>
>
>
> if( $line[1]='$bruker' and $line[2]='$passord') {echo "hei
> $bruker.";}
> else {echo "FEIL";}
>
> -----Original Message-----
> From: chris [mailto:tometerlaks@hotmail.com]
> Sent: Wednesday, March 20, 2002 8:15 AM
> To: php-general@lists.php.net
> 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