php - Get last post in each category -
i've got 4 tables:
1. forums (id,forum_id,name,group_id) - there categories , sub-categories 2. topics (id,forum_id,user_id,name,dt,deleted[default - 0]) 3. posts (id,topic_id,text,edit_dt,user_id,deleted) 4. users (id,name)
what best way main categories last posts? or maybe add in forums table new fields - last_post_id
,last_post_name
,last_post_dt
, , @ delete,
add new topic/reply update these fields?
at first, identify "last post" should add timestamp (datetime) posts table.
also, in question, define categories (i presume it's topics) , example of data, paired example of desired output.
Comments
Post a Comment