dadamssg Posted August 6, 2009 Share Posted August 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/169034-organizing-forum-table/ Share on other sites More sharing options...
smerny Posted August 6, 2009 Share Posted August 6, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/169034-organizing-forum-table/#findComment-891828 Share on other sites More sharing options...
kickstart Posted August 6, 2009 Share Posted August 6, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/169034-organizing-forum-table/#findComment-892250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.