[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
RE: [PHP] why doesnt this work???
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
Re: [PHP] why doesnt this work???
nope... that did not do the trick... -Chris Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
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
RE: [PHP] why doesnt this work???
Hi, I am not an expert, but try if( $line[0]='$bruker' and $line[1]='$passord') {echo hei $bruker.;} else {echo FEIL;} atb Lars -Original Message- From: chris [mailto:[EMAIL PROTECTED]] Sent: 20 March 2002 14:22 To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? nope... that did not do the trick... -Chris Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
Re: [PHP] why doesnt this work???
It still just comes out blank when the vars is wrong R'Twick Niceorgaw [EMAIL PROTECTED] wrote in message 020501c1d01b$11eb1d00$[EMAIL PROTECTED]">news:020501c1d01b$11eb1d00$[EMAIL PROTECTED]... 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
RE: [PHP] why doesnt this work???
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
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:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:22 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? nope... that did not do the trick... -Chris Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
Re: [PHP] why doesnt this work???
it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
RE: [PHP] why doesnt this work???
Try this 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:33 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why doesnt this work???
Thanx for all the help guys, but i have tried all of the sugestions but the one that works best is the one i startet with... but that one does not work 100% either...im so confused my head is about to fall of i just dont get it... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:33 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why doesnt this work???
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:[EMAIL PROTECTED]] Sent: 20 March 2002 14:30 To: 'chris'; [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:22 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? nope... that did not do the trick... -Chris Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
RE: [PHP] why doesnt this work???
This works; I just tried it. ?php $line = bruker; $bruker = bruker; $linex = passwordx; $password = password; if( !strcmp($line,$bruker) !strcmp($line,$password) ) {echo hei $bruker.;} else {echo FEIL;} ? -Original Message- From: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:41 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? Thanx for all the help guys, but i have tried all of the sugestions but the one that works best is the one i startet with... but that one does not work 100% either...im so confused my head is about to fall of i just dont get it... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:33 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- 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
RE: [PHP] why doesnt this work???
This works : ?php $line = array('','bob','tpw'); $bruker = 'bob'; $passord = 'pw'; if($bruker == $line[1] $passord == $line[2]){ 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:41 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? Thanx for all the help guys, but i have tried all of the sugestions but the one that works best is the one i startet with... but that one does not work 100% either...im so confused my head is about to fall of i just dont get it... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:33 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- 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
RE: [PHP] why doesnt this work???
Hi, Let me explain what is wrong with this line: if( $line[1]='$bruker' and $line[2]='$passord') when you use = instead of == it will always be true because you set $line[1] to $bruker, you have to compare them by using ==. Also looking at your sql query $line[0] would contain your username and $line[1] your password! try after $line = mssql_fetch_row($result); echo DEBUG : $line[0] - $line[1] - $line[2]; if( $line[1]='$bruker' and $line[2]='$passord') echo hei $bruker.; else echo FEIL; Regards Lars Stampe -Original Message- From: chris [mailto:[EMAIL PROTECTED]] Sent: 20 March 2002 14:41 To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? Thanx for all the help guys, but i have tried all of the sugestions but the one that works best is the one i startet with... but that one does not work 100% either...im so confused my head is about to fall of i just dont get it... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this 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: chris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 8:33 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] why doesnt this work??? it all works just fine exept that when the vars is wrong i get a blank page...wich means that the else echo doesnt work for some reason... and if i use == the correct vars become wrong... but it does print the else echo... hmm... Robert Collins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- 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
Re: [PHP] why doesnt this work???
Hello, I read a ton of replies to this already, and there was a lot of good advice. However, it should be worth noting (and I don't think anyone did already) that you have a misspelling in this code: snip $password = ; // . . . $query = select * from medlemmer where bruker = '$bruker' and passord = '$passord'; // . . . if( $line[1]='$bruker' and $line[2]='$passord') echo hei $bruker.; /snip You initialize the variable as $password, but refer to it as $passord (no 'w'). Maybe that was just a typo in the email, but that will definitely be a problem in the code, too. Of course, all the other advice ('==' instead of '=', '' instead of 'and', etc...) should be heeded as well... -- [ joel boonstra | [EMAIL PROTECTED] ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why doesnt this work???
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php