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
https://forums.phpfreaks.com/topic/77577-proper-rating-system/
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
https://forums.phpfreaks.com/topic/77577-proper-rating-system/#findComment-392997
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.