Well, its been quite a while since I sat up all night to complete something! 😀 I think I’ve barely managed to get the hang of PHP atleast enough to manage to put up a voting application, that can dynamically generate a questionaire based on questions in a database.

It all started when a bunch of us who watch a Kannada TV serial decided to actually meet up. For which we needed to come to a consensus on date and venue. Of course this could be resolved either just by one person taking the decision, or by exchanging a lot of emails or comments to arrive at a consensus.

But that’s what we need to use computers for, to keep track of such mundane things as statistics!

Also, being with Microsoft technologies for almost a decade now. But still I’ve been quite inspired after experiencing the sophistication of WordPress (the platform for this blog) to atleast get started with open source technologies myself… I’m pretty much convinced that the future lies in open source.

So a bit of googling came up with…

PHP Online opinion poll script using MySQL

…which was a pretty neat tutorial which gave a bit of source code for just one question. So I modified it to make it dynamically generate the page as well as resulting graphs based on any number of questions in the database.

Currently the answers are fixed to be one of four fixed answers (objective type) but in future I’d like to make the answers more flexible, even answers that can be contributed by the voters so that others can vote on the answers! And farther away into the further, I can see a framework coming up, a wizard to generate questions, different kinds of answers, different kinds of report generation and statistics… hmm…

Also an important feature is if a voter votes again, the vote changes, instead of making it count twice.

You can have a look at it here

Learnt many interesting things about PHP in terms of its amazing set of functions. One really cool feature about MySql…

INSERT INTO table (a,b,c) VALUES (1,2,3)

…but unfortunately couldn’t get this to work – even though I tried out the Update and Insert statements seperately, it kept saying there was some error in the SQL. Hence had to implement the same logic through PHP code.

I’ll announce the poll site for use maybe tomorrow.

But how to ensure only relevant people vote in it and not all visitors? One possible authentication scheme is to check if the voter has made atleast one post in the Muktha thread!

But atleast the whole excercise gave me the confidence that I’ve managed to still not lose touch with basic programming using an entirely new technology! 😀