[thelist] PHP - While Loop

Kath Kath at cyber-kat.com
Thu Aug 14 10:13:18 CDT 2003


I'm just beginning to learn PHP using  PHP and MySQL Web Development by
Luke Welling and Laura Thomson.

I'm up to the Conditionals - While Loop section.  I opened an example they
have and it doesn't seem to work on my set up, though it does work if I
upload the file to my server.  I have an Apache/PHP 4.2.3/MySQL set up on
my Windows 2000 PC.

Here is the PHP code ...

$distance = 50;
while ($distance <= 250 )
{
  echo "<tr>\n  <td align='right'>$distance</td>\n";
  echo "  <td align='right'>". $distance / 10 ."</td>\n</tr>\n";
  $distance += 50; 
}

And this is the output on my PC ...

Distance Cost 
\n\n"; $distance += 50; } ?>  

I have no idea why it doesn't work in my testing environment.  Is there
something else I need on my system besides Apache/PHP 4.2.3/MySQL?

Is there more information I need to provide to more closely pinpoint the
problem.

I would love for the test environment to work so I don't have to keep
uploading these "learning" files to my web site.

TIA

Kath ...  "A patriot must always be ready to defend his country against its
government."  -Edward Abbey, naturalist and author (1927-1989)
Established 1995 --> www.cyber-kat.com



More information about the thelist mailing list