Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 6 of 6

Thread: PHP/MySQL Comment System

  1. #1

    PHP/MySQL Comment System

    I have something like 100 different items stored in a database. I want to create a comment system for each one and I was wondering what the best approach would be for something like this.

    1. Create a separate database for comments and have each item with its own table within that database to store the comments information.

    2. Create a table within the existing database and just store all comments withing that table and pull them according to whichever item the visitor is viewing.

    I was wondering which method would be quicker and better, or any other ideas on how to accomplish this.

    Thanks in advanced.
    Last edited by cubed; December 28th, 2007 at 10:17 PM.

  2. #2
    Give all the items an id.

    Then make a comments table. Create an items_id column, and just reference comments by items_id.

  3. #3
    That was my second idea but I wasn't sure if I would run into any kind of lag issue with such a giant table. Do you know if there really would be any kind of speed differences between the two options I mentioned?
    Last edited by cubed; December 28th, 2007 at 10:27 PM.

  4. #4
    I'd say the separate database with multiple tables is way messy and inefficient.
    got pwnt?

  5. #5
    I thought it would be more organized, but I guess I'll be sticking with just a single table. Thanks for the help guys!

  6. He's right. Not only would your first idea be unorganized and turn into a HUGE mess after time went on, but it would require more of a server load to close the first database connection and open it up again to get into the separate db. The separate table method is time tested and is quite probably the best and most efficient way to do it.
    "Give me the place to stand, and I shall move the earth" - Archimedes
    "The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts." - Bertrand Russell

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012