Dynamic Websites
I downloaded the database for this from the HotelsCombined.com data feed. The feeds are in a large XML file, so I wrote a script to retrieve them from there and copy them into a MySQL database.
The search box on the homepage uses jQuery's autocomplete plugin, and uses the 'cities' table in the database. Once the search query is submitted, an AJAX request is sent to the server, which returns any hotels in the same city. You can then view the hotel page, which shows some basic information, pulled from the 'hotel' table.
The main challenge for this project was learning how to handle the XML file (which contained 100,000+ hotels!), and how to transfer the information across to a database. Once this was achieved, it was quite straight-forward to pull the data when a request is submitted.
AJAXified, automatically updating table
admin |
client
This project consists of an admin page, where the admin can add and delete entries in the database, and a client page, which displays the current entries. The client page contains a timer (set to 30s at the moment), which calls functions periodically, which check if there have been any changes in the database, adding or removing the entries as required.
This makes extensive use of PHP, MySQL, and AJAX. To best appreciate how it works, you should open both the admin and client pages, add and remove entries, and watch as the client table is updated every 30 seconds. I was initially attempting to emulate some techniques used on Twitter, and the project evolved from there.
Hostelworld.com Reviews
add |
display
This project creates a review system for hostels, which allows the visitor to give various ratings, and add comments. I just used Hostelworld.com as an example, in order to give the page some styling. Once again, this project uses PHP, MySQL, and AJAX. I used jQuery's AJAX functions for the first time, and found them to be a very efficient and neat way to interact with the server. I also added some JavaScript to validate the user input for the name and email fields, and I used PHP functions to prevent SQL injections also.
You can add reviews at this page, and then see the submitted reviews here.
This example uses PHP's $_GET function to pass values to different processing scripts for adding and deleting entries in the database. It uses AJAX to do this asynchronously, without the need to reload the page each time to see the updated table.
This example allows the user to register a new account, which is added to the database. The application then uses sessions to allow the user to log into their members' area, and add and delete 'notes'. These notes are stored in a database, and can be only seen by the user who enters them. There are no doubt security vulnerabilities present, and these will be addressed as I learn more about PHP.
I wanted to retrieve data from a table on another website, so I wrote a simple PHP script to do this. The example I used is the US National Wildlife Health Center quarterly mortality reports. I just wanted the numbers in the 'Mortality' column for all of the available years/quarters. In this example I just go as far as 1998 (because it takes a while to load), but the script can go loop through every year.