views:

149

answers:

2

I am in the very beginnings of teaching myself php. I am giving myself micro projects to push myself.

Thus far I have a MYSQL database, created through a php form. One Column is for karma. I have the values of the database table display in an html table, and at the end of each row, I would like a click on a hyperlink, lets say a plus sign, to increase that row's karma level by 1. Then the plus sign would go away.

I should that each row has an auto increment integer as a primary key.

+7  A: 
Jonathan Sampson
+1 for providing a simple yet thorough answer.
Austin Hyde
It might also be a good idea to cache vote counts, especially for popular questions.
Dana the Sane
+2  A: 

Personally I like Jonathan's answer.

However if you feel like you might need more info, I might be able to help.

As a small side project I tried to make a quote database like bash.org for my university.
It was developed using MySql and PHP, it has posting/voting much like what you are trying to accomplish.
It is by no means a well designed web app. However it might be able to get you going in the right direction.

Live testing site: link (be gentle!)

Code on GitHub: link

I would take a look at the database schema , the php-db-integration and the ajax to update a vote.

The code is fairly simple and straight foreword. One thing of note is the "filter_input"s, These functions are from a PHP library to sanitize user inputs to prevent SQL injections.

Brian Gianforcaro