I think this is normal PHP behavior. The $result variable is considered an 
"array" by the MySQL functions, so every time you call mysql_fetch_, you 
remove an element from the "array" (I don't think it's really an array but 
it's the best comparison I could find).

My solution would be to create an array of your own and store each row into 
the array, but Piotr's idea might just do the trick.

Hope this helps,

Olivier

At 17:05 2002-05-09 -0400, Matt Babineau wrote:
>After I output data from a query with a for() loop, It seems like I
>cannot reuse the array from the query any more. Do I have to requery the
>database for the same info so that I can add up the database columns?
>
>        <?PHP
>
>        $bgcolor = "Silver";
>        $bgcount="0";
>        for ($i=0; $i < 10; $i++ ) {
>         if ($bgcount == 1) {
>          $bgcolor = "White";
>          $bgcount = $bgcount + 1;
>         }
>         else {
>          $bgcount = "0";
>          $bgcolor="EFEFEF";
>         }
>         $rows = mysql_fetch_array($result);
>        ?>
>         OUTPUT DATA HERE
>         <?PHP
>         }
>         ?>
>
>After this has run, when I try to run another for() loop on the same
>$result using the $rows variable it doesn't work. Any ideas?
>
>
>Matt Babineau
>Freelance Internet Developer
>-----------------------------------------
>e:  <mailto:[EMAIL PROTECTED]>
>[EMAIL PROTECTED]
>p: 603.943.4237
>w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com


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

Reply via email to