[PHP] Averaging user ratings

Hey everyone. I have a game review website that I’m nearly finished with, but someone came up with the excellent idea of allowing users to rate the game being reviewed to give a user rating of the said game.

Currently my review page is very simple in that it just loads the information from a mySQL database with the review, rating, ect. but I’m not sure how to go about making an averaged review score.

I’m pretty sure I would need to make a database table to record each users rating and the ID of which review they were rating, but I’m not sure how to go about getting PHP to load all the ratings where the ID = review ID then add them all together then divide by the number of ratings.

Any ideas on how to do this? Any help is appreciated!