Forum Moderators: coopster

Message Too Old, No Replies

Inaccurate mysql_fetch_array result

         

raretimeposter

1:41 am on Dec 21, 2004 (gmt 0)

10+ Year Member



When I use this code:
while($row=mysql_fetch_array($result)){

it DOES work, BUT it always gives me ONE LESS out of the array than it should.

ex) If I have 5 items in the array, it'll only print out 4, etc when I use the echo commands.

PS. I fogot to thank the puerson who helped me last time when I posted here. :headsmack: His suggestion did work! Now I can't find it.

raretimeposter

2:00 am on Dec 21, 2004 (gmt 0)

10+ Year Member



Oh, nertz. I found out what I was doing wrong! I was using, as a checking counter, that statment twice.

It seems that each time you use it, even if you're putting the "results" into a different variable, it gets decremented.

So, I was getting one less than I was expecting.