PHP Rating system

Hello. I’m trying to create a PHP rating system. I’ve got the client side coding all down, now it’s just a matter of figuring out how to code the PHP so that it tallys the votes. To see what I’m talking about, view the rating system on the left side of this site:

http://www.gamegum.com/game/139/overrun--the-final-chapter/

I understand that the achor will look like this:

<a href="<?php insert_vote_into_database(1); ?>">1</a>

My problem is I don’t know how to code the SQL or the PHP in that function to tally up the votes. Any help?