Re: Generating Sub Headings

From: Date: Thu, 19 Feb 2004 19:34:24 +0000
Subject: Re: Generating Sub Headings
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-178289@lists.php.net to get a copy of this message
That's exactly it! I don't know why I didn't think about that. For anyone else reading this, I added $field = mysql_fetch_array($dbArray); above the line that reads $yeartitle = $years["year"]; And now it works! "Richard Davey" <rich@launchcode.co.uk> wrote in message news:1849384669.20040219191241@launchcode.co.uk... > Hello Nicole, > > Thursday, February 19, 2004, 6:28:13 PM, you wrote: > > N> And so on, always putting the right years and the right number of histories > N> below the year, but always listing the first history and nothing else. My > N> loop works if I don't have the while loop in there with the subheadings ... > > In looking quickly at the code, I can't see a chance for the $field > value to ever be updated. You call it once (in the first while > statement) and populate the field array with the SQL results, you then > move into the 2nd while loop which handles the years. But once in that > loop you don't fill the $field array with any new data, so it's using > the same data over and over again for every year. I believe, although > I've not looked at it for very long, it's simply that the while loops > are nested in such a way that the field values never get a chance to > re-populate themselves. > > -- > Best regards, > Richard Davey > http://www.phpcommunity.org/wiki/296.html

« previous php.general (#178289) next »