[thelist] PHP - While Loop

bruce bedouglas at earthlink.net
Sat Aug 16 11:40:11 CDT 2003


kath...

i previously asked you to post the entire file. you posted a part. i posted
an entire file in response to your posting and asked you to try it...

did the file i posted work for you?

if it didn't or for some reason you never got the file i posted, repost the
"entire" test file that you have.....

i'll take a look... also email me your number, and i'll give you a call,
assuming you're in the US/Canada/Europe...

also, send the results of what you get when you type:

php -i
php -v


regards,

bruce
bedouglas at earthlink.net
(925) 866-2790


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org]On Behalf Of Kath
Sent: Saturday, August 16, 2003 8:56 AM
To: thelist at lists.evolt.org
Subject: RE: [thelist] PHP - While Loop


Hi again - sorry this exchange got derailed by the Great Blackout of 2003.
We were without power from a little after 4pm EDT to 7:30am - major pain.
After the power came back on, they asked us not to use appliances unless
absolutely necessary.  I chose fans over my computer - what can I say the
PC generates heat and I hate being hot <g>.

Anyway - back to my problem with the While loop ...

At 01:01 PM 8/14/2003 -0500, Keith wrote:
>Have you tried putting parentheses around the math expression?
>
>echo "  <td align='right'>".($distance / 10)."</td>\n</tr>\n";

Didn't work :- (

>If that doesn't work, could you post the actual source the php generates?

This is what appears between the BODY tags on "view source"
<table border="0" cellpadding="3">
<tr>
  <td bgcolor="#CCCCCC" align="center">Distance</td>

  <td bgcolor="#CCCCCC" align="center">Cost</td>
</tr>
<?
$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;
}
?>
</table>

Looks like it is not interpreting the PHP correctly.

When I load the page from my web host server, it looks like this ...
<table border="0" cellpadding="3">
<tr>
  <td bgcolor="#CCCCCC" align="center">Distance</td>

  <td bgcolor="#CCCCCC" align="center">Cost</td>
</tr>
<tr>
  <td align='right'>50</td>
  <td align='right'>5</td>
</tr>
<tr>
  <td align='right'>100</td>
  <td align='right'>10</td>

</tr>
<tr>
  <td align='right'>150</td>
  <td align='right'>15</td>
</tr>
<tr>
  <td align='right'>200</td>
  <td align='right'>20</td>
</tr>

<tr>
  <td align='right'>250</td>
  <td align='right'>25</td>
</tr>
</table>

All of the other PHP I have done since I started with the book has worked
correctly.

I have done mostly input forms with a page to display the output.  I even
got adventurous and tried to add some things that were not part of the
tutorial.  All worked fine until I came to this.

Anthony had asked ...
>Obvious question: what extension is your file? Is IIS set to parse that for
>PHP?

I have Apache set up, so I'm not using IIS for the PHP environment.

I should mention again that this is not code I wrote.  It is an example
from the CD that came with the book.  I was wondering if there wasn't
something wrong with it until I uploaded it to my web space and it worked.

Well thanks again for all your suggestions.  I'm assuming the code is
correct since it works on my web host server, but I sure would love to know
why it's not working on my system.


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

--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list