Seems I found the solution. If I knew SELECT DISTINCT sql query, I could have done it before I email :-) .

To anyone who has similar issue, please take a look at:

http://www.garfieldtech.com/blog/php-group-by



Thank you all!

---
Sincerely,
Enkhbilguun Erdenetsogt



On 10.01.03 4:54, Ralph Schindler wrote:
How do you distinguish sub-article in your database?

-ralph

Enkhbilguun Erdenetsogt wrote:
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)
          o Article 1 (column cat_id)
                + Sub Article 1 (column name with description)
                + Sub Article 2
                + Sub Article 3
          o Article 2
          o Article 3
          o 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

<<attachment: enkhbilguun.vcf>>

Reply via email to