Friday 18 March 2011

IDAT209 - The Six Wedges Website

The website was the part of the project that I was assigned to do. It uses php and mysql to store and display players' profiles and statistics.

First things first I had to code the html and forms that would be used for users to log in and register etc. I knew that when I took on the responsibility that this would probably be the easiest part of the coding this website. Next I created the database, I decided that I would go with four tables. One would be a player's table that would hold all of the user's details such as the emails and passwords and they would be assigned a user ID as this will be useful for later. The next table I made was the category table so I can assign them ID numbers aswell to make things easier for the questions table. This table has rows for category id, the question, the correct answer and the four possible answers. Finally I created a progess table that tracks how the players are doing. Each question has 4 states, not seen, seen and not answered, answered wrongly and answered correctly. Now we have the tables set up we can start coding the php.

First I did the login system which checks the players table for what the user types into the text boxes and if its the same as what is in the table. Next was to set up the registration page, this pulls in what the user has typed into the text boxes and adds a new entry into the players table. Now that was out of the way it was time to start coding the most important page the question page. This is where the user would be taken once the QR code has been scanned, to get this to work I needed to display data from the questions table to show them and once they've been answered I needed to check the login details and then update the progess table to say whether they have it right or wrong. The hardest thing about this page was what to do if it wasn't a returning user but a new one looking to register. To bypass this I used the same form as the login but added a tickbox and asked the user to tick it if they were a new user looking to register, if this was ticket I needed to add a new user to the players table and update their progess table aswell, this took my a fair amount of time to complete but eventually worked fine.

I'm quite pleased with the outcome of the webpage and its probably the hardest thing i've had to code so far. I managed to get my heard around it but there were parts where I had to get help with to finish. All it needs are the usual finishing touches such as css and a few things to be ironed out but its essentially finished.

No comments:

Post a Comment