2010年1月2日星期六

Re: [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

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

没有评论: