Need help with a rating script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RhapX
Forum Commoner
Posts: 30
Joined: Mon Dec 05, 2005 5:24 pm
Location: Seattle, Washington

Need help with a rating script

Post by RhapX »

Hello,

I am writing a script for a rating system and it seems that the only thing I can't figure out is how to add up all the cells. I have a cell named review_rating and want to add up all the values in that cell.

For instance, I have 4 rows of rating values (1, 3, 5, 3). All together they should add up to be 12. How would I add those together?

I am pulling them in an array through an SQL query.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

SELECT SUM(`table_field`) FROM `table`
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
RhapX
Forum Commoner
Posts: 30
Joined: Mon Dec 05, 2005 5:24 pm
Location: Seattle, Washington

Post by RhapX »

Thanks!
Post Reply