Need help coding category page

I am developing a small forum like program for my website. I need a way to categorize the posts. I have almost no idea where to begin. Help would be much appreciated.

add categories (and threads?) to your database, then modify your queries to select using these.

example database that stores your posts into discussion threads, and the threads into categories. Much like this forum

id, thread_id, user_id, text, time_posted, deleted

id, category_id, user_id, title, deleted

id, title, description, active, deleted[/code]

ie, if you today just list all posts (select * from posts order by id desc limit 0,30)

you could do something like this to list categories

select * from categories
where active = 1 and deleted = 0
order by id desc limit 0,30

and then this to list threads in the category the user clicks on

select * from threads
left join posts on posts.thread_id =
where threads.category_id = ? and deleted = 0
order by id desc limit 0,30

and lastly your normal select single thread
select * from posts
where posts.thread_id = ? and deleted = 0
order by id desc limit 0,30

Obviously this will have to be modified to suit your needs

Sponsor our Newsletter | Privacy Policy | Terms of Service