Jump to content

organizing forum table


dadamssg

Recommended Posts

would it be easier to have fields in my Topics table that are Last_Post...that would contain the user who last posted on that topic and when OR to write a crazy query that would pull this up for me. I have a seperate table for the Replies.

 

was thinking whenever someone submitted a replie i could just update that Last_Post field in the Topics table with that info...but then if i had to delete that reply for whatever reason the Last_Post wouldn't be accurate.

 

on the other hand, i could beg you guys to help me write a query that would

A. pull up all topics and their info

B. WHILE, pulling up the last post info from the replies table

 

 

thoughts?

Link to comment
Share on other sites

a query that gets the last post by getting the latest in the post table with the right topic id will always be the most sure way to make sure the content is correct...

 

you could save some stress doing it the other way though, if that is a problem for you... and in that case, you could also make it so when you delete a post, it searches the posts with the right topic id and re-sets the most recent post in the topic table

Link to comment
Share on other sites

Hi

 

Integrity wise it would be best to have a fully normalised database and just perform a sub query to get the last post, but efficiency wise it is probably best to store the last post (this is what phpBB 2 does). Especially as on a forum with the last post details displayed on the list of topics the number of reads will massively outnumber the number of updates.

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.