Jump to content

Proper rating system


brendan6

Recommended Posts

Im trying to install a product rating system based on the average of customer testimonials.  My question is whether it will be better to better to have an "average_rating" field in my database and maintain it for every new customer review or determine the average by querying for every review and getting the average on every page load...

Link to comment
Share on other sites

No matter how you search them, you'll have the same amount of queries, because you will need to load them into an array, then let PHP sort the array on whatever criteria you need. If you store that array into a SESSION var, then make copies of it whenever you need to do a custom sort or whatever, then in effect you have created a 'cache' and MySQL will not need to queried again (on a per-user basis). You have to 'think ahead' of your programming sometimes.

 

Anyways, as to this question:

> [- snip -]would be slow/bog down the server?

 

That question is -always- answered by what kind of machine is running the database, how many other large apps are sharing the resources, and most importantly, how much memory and the quality of that memory. MySQL likes memory. Lots of it. = )

 

PhREEEk

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.