2010年1月2日星期六

[fw-db] How to print a single column ordered/grouped list from db table data?

begin:vcard
fn:Enkhbilguun Erdenetsogt
n:Erdenetsogt;Enkhbilguun
email;internet:enkhbilguun@beregu.com
tel;cell:99113638
x-mozilla-html:TRUE
version:2.1
end:vcard

Happy New Year,

I would like to print articles list ordered/grouped by year column of my db table, but I can't find how I should loop to print something like the following:

  • 2007 (column year)
    • Article 1 (column cat_id)
      • Sub Article 1 (column name with description)
      • Sub Article 2
      • Sub Article 3
    • Article 2
    • Article 3
    • Article 4

To print the above list with the below table data, I need to make all the same year value to one and every articles (column cat_id) should be included in it, but because of my poor knowledge of php and OOP, I couldn't find simple way to loop them.

My table structure looks:

id | type | cat_id | year | name | description ......



Thank you for your help my friends.


---
Enkhbilguun Erdenetsogt

没有评论: