[thelist] php/mysql question

Dunstan Orchard dunstan at 1976design.com
Wed Mar 19 05:03:02 CST 2003


Hi there,

I have a db with the following fields in:

postid     int(11)
postdate   date
posttitle  tinytext
postbody   text

And I'd like to do the following:

[1] Select the last 30 posts
[2] For each month that the posts fall into print a heading of that month
[3] Then print all the posts within that month
[4] Keep going until my 30 posts have been printed

So an example output might be:

FEBRURARY

posttitle 89

posttitle 88

posttitle 87

JANUARY

posttitle 86

DECEMBER

postitle 85

posttitle 84

etc... up to 30 posts.

Could anyone recommend the best way of achieving this in php?

---------------------------
Dorset, England
http://www.1976design.com/
http://www.orchard.it/
http://www.maccaws.org/


More information about the thelist mailing list