Rike Posted July 15, 2014 Share Posted July 15, 2014 Hallo everybody! I am looking for some information about creating PHP threaded forum (with MySQL). BB forum is easy - db table with forums, topics and posts, every post has foreign key to topic, topic to forum and it's done. But if I want something like Disqus, how to do this more efficiently? How to collect posts in db with minimum query needed to render any thread? And what about post rating? How to prevent user from sending more then one rating? Quote Link to comment https://forums.phpfreaks.com/topic/289894-threaded-forum-algorithm/ Share on other sites More sharing options...
Solution requinix Posted July 15, 2014 Solution Share Posted July 15, 2014 Database: learn about adjacency list (requires a parent->child relationship) versus nested sets (requires... something more complex). They have complementary advantages and disadvantages - meaning one's strength is the other's weakness. Post rating: require a login and track every user's rating so you'll know if they've voted before. Quote Link to comment https://forums.phpfreaks.com/topic/289894-threaded-forum-algorithm/#findComment-1485148 Share on other sites More sharing options...
Rike Posted July 15, 2014 Author Share Posted July 15, 2014 Thank you, nested sets looks very good for me And what about ratings and optimal db solution? For example: post_id, user_id table looks to be very big. Quote Link to comment https://forums.phpfreaks.com/topic/289894-threaded-forum-algorithm/#findComment-1485192 Share on other sites More sharing options...
requinix Posted July 15, 2014 Share Posted July 15, 2014 If you don't mind I'm moving this to the MySQL forum as you're asking more about database design than coding. Yes, there will be a lot of rows, but databases are designed for this sort of thing. As long as you're using good normalization practices and proper indexes, everything will perform smoothly. Quote Link to comment https://forums.phpfreaks.com/topic/289894-threaded-forum-algorithm/#findComment-1485291 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.