Re: echo?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11-03-22 06:22 PM, Jim Giner wrote:
Kinda new to this, but I've been puttering/writing for about 3 weeks now and
have some good working screens up.  Ran into something new while I was
debuggina script today.

Tried to echo the $i value within a for loop as part of the list of items I
was building
Something like

for ($i=0;$i<$rows;$i++)
     echo $i.' '.$row['itemname'];

I expected to see :

1 item1
2 item2
...
...

but instead I got

1 item1
f item2

Yes - an 'f' and not a 2.

Tried it some more with this:

for ($i=1;$i<10;$i++)
     echo $i." item".'<br>';

and got

c item
d item
e item
f item
g item
....
and so on.

It seems that I can only output the value of $i if I output a string in
front of it

echo ' '.$i;

works fine but
echo $i;
does not.

Any ideas?

I'd like to see the actual code... since $row['itemname'] wouldn't change between iterations either.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux