Re: Retrieving data woes
| From: | DL Neil | Date: | Mon, 10 Dec 2001 16:48:42 +0000 |
| Subject: | Re: Retrieving data woes | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14910@lists.php.net to get a copy of this message | ||
Hi Andres,
> I have what probably is a basic question, but can't figure out by
> myself. If
> any of you kind souls can point me in the right direction I would
> appreciate
> it.
>
> I have a db table that has these columns:
> id, date, time, title, body
>
> some of the rows can have the same "date" and want to output the data
> according to "date". Like so:
>
> dateA
> timeA1, titleA1
> bodyA1
>
> timeA2, titleA2
> bodyA2
>
> dateB
> timeB1, titleB1
> BodyB1
>
> etc.
>
> Think of a weblog structure. I know how to output the information row by
> row, but not like above. Can any of you help me?
=use PHP to loop through the resultset:
retrieve data
while not eod //loop through resultset retrieved
echo //output the blank line
echo date
while date_unchanged and not eod //loop through all the records for one day
echo time, title
echo body
echo //output the blank line
end while //date loop
end while //resultset loop
NB I use a function to return a data row from the resultset and flag eod as a boolean
eod = end of data (in the resultset)
=welcome to programming!
=dn