FW: [PHP-WIN] If statement inside of for statement
| From: | Stan McCowan | Date: | Mon, 10 Feb 2003 05:12:55 +0000 |
| Subject: | FW: [PHP-WIN] If statement inside of for statement | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18424@lists.php.net to get a copy of this message | ||
Matt,
I'm pasting a couple of values from a form page.
I'm check against a flat file database.
After the for each statement display the string $line and $move.
the value are equal, but the if statement is not executed.
Stan
-----Original Message-----
From: Matt Hillebrand [mailto:matt@medmarket.com]
Sent: Sunday, February 09, 2003 7:59 PM
To: 'Stan McCowan'
Subject: RE: [PHP-WIN] If statement inside of for statement
You'll have to be more descriptive than that. There's nothing wrong with
your syntax... Although, I would add some <BR> tags in your output if I
were you.
Matt
|-----Original Message-----
|From: Stan McCowan [mailto:stanmc@attbi.com]
|Sent: Sunday, February 09, 2003 9:04 PM
|To: php-windows@lists.php.net
|Subject: [PHP-WIN] If statement inside of for statement
|
|
|I'm having a problem with the if statement not working inside
|of a for statement.
|
|Is there something I'm missing.
|
|<?php
|
|$auth = 'NO';
|$user=$_POST['user'];
|$pass=$_POST['pass'];
|$move=($user.":".$pass);
|
|$filename = 'ADMIN/file.txt';
|$fp = fopen( $filename, 'r' );
|$file_contents = fread( $fp, filesize( $filename ) );
|fclose( $fp );
|$lines = explode ( "\n", $file_contents );
|
| foreach ( $lines as $line ) {
| echo $line;
| echo " - ";
| echo $move;
|
| if ($move==$line)
| {
| echo "This is MOVE = ";
| $auth = 'YES';
| break;
| }
| }
|?>
|
|
|
|--
|PHP Windows Mailing List (http://www.php.net/)
|To unsubscribe, visit: http://www.php.net/unsub.php
|
|
|