Storing results of a 5-star rating system

I built a database-driven resource for a client that stores and displays the names and information of certain ‘items’. Eventually the database will contain 500+ of these ‘items’.

They now want me to add a rating system to the display of an individual item, but do not want me to build one from scratch (less cost to them). I found one that should work, but I have a few questions about it:

  1. The results are stored in a text file instead of a database. If there are voting results for more than 500 items, would the text file still be appropriate?

  2. This rating system comes from a basic tutorial, so it does not have any measures put in place to ensure a user only votes once. I know I will need to use cookies for this somehow, but I am a bit rusty in Javascript and have next to no experience with cookies. How complicated will this process be?

Hi WebMachine,

To answer your questions:

  1. I would definitely store the ratings in the DB - it’ll be a lot easier to manage and query the data.
  2. Set a cookie from PHP (I’m assuming this is the server-side language that you’re using?). If you check for the presence of the cookie when the page is requested, you can take the appropriate action like disabling / not rendering the rating control. Checkout the PHP manual page for some examples of working with cookies.

Thanks, @fretburner . I will set up a new table in their current database then and modify the code. I will probably be back here asking questions later about the connection between the javascript in this system, and the storing of the data in the database.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.