CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    5

    Question Article Ranking System - PHP, MySQL

    Hi

    I'm starting to develop a website that allows users to rate articles. I am currently stuck with a bit of a problem.

    Do I store a rating for each article from each user in a table and query it every time I want to know an articles rating, or I want to know a users average rating?

    OR

    Do I store these in the article and user tables so that I don't have to query the database as heavily every time I wish to know this data?

    OR

    I could do both and update the ratings every time a new rating is added. This would mean that the database isn't over-queried every time a user loads a page.

    Any insight would be really helpful

    Dan

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Article Ranking System - PHP, MySQL

    The answer all depends on how much data you want in the future. If you can say 100% that you will never need to know how many times an article was rated or by whom...then you can average them.

    Personally, I would store all ratings in a table and query. You never know when you're going to look back and wish you had that data all along. There's no way you're going to overload your database unless you are querying wrong and have millions of users connecting per minute.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured