Adding togeather all ratings from my results.
Ok I have a table called ratings and in the table it is layed out like this.
ID | UserID | Rating | TMDB | TYPE
-----------------------------------
1 34 6 432 3
-----------------------------------
2 34 9 432 3
My sql is
$sql = "SELECT * FROM `tbl_rating` WHERE `tmdb`='" . $tmdb . "' AND `type`='" . $type . "' ";
ok this pulls up the information I want. I can now use a while or foreach command to call $row['rating']. However I dont know how I can add the results togeather or do any basic math. This is a movie rating database and I am trying to get my script to add togeather all the "ratings" in the results column and then work out the average vote.
I hope this make scence. Any help would be great thank you all!
this script has star rating for Gore, Scare, Acting, Story (this is the where I use the type field).