Re: Data output
| From: | Piotr Pluciennik | Date: | Thu, 09 May 2002 21:21:56 +0000 |
| Subject: | Re: Data output | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13670@lists.php.net to get a copy of this message | ||
Hi Matt,
in your code unfortunately it's not clear how you are
outputting data from an array, so I'm not sure... but
try reset($rows) function - it will set internal
pointer of array to first element... Consult manual
for array functions, specially for reset().
HTH, let me know
Piotr
--- Matt Babineau <mbabineau@illuminatistudios.com>
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:mbabineau@illuminatistudios.com>
> mbabineau@illuminatistudios.com
> p: 603.943.4237
> w: <http://www.illuminatistudios.com/>
> http://www.illuminatistudios.com
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com