Jump to content

Threaded forum algorithm


Rike
Go to solution Solved by requinix,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

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.