Uppsala universitet

Lab: PHP and MySQL Web Development

This lab is to be completed using the Linux-Apache-MySQL-PHP, or LAMP, Web development framework. You are allowed to work in groups (3-5), preferably the same groups that you form to complete the project for the course. For ease of deployment of your solution, each group is provided a MySQL account on linne.it.uu.se. Please come and see the Teaching Assistant (TA) during the lab to get the account information for your group.

For this simple assignment you can simply use your favorite text editor on your Unix account and place the source files of your solution under your public_html/ library. For the course project you are advised to use an IDE, e.g., Netbeans 6.5 IDE which has PHP support.

Tutorial lecture slides

PHP + MySQL crash course (ppt, pdf).

Getting started

From w3schools learn or refresh your memory about basic HTML tables, HTML forms, PHP+MySQL, and SQL.

Do the following PHP / MySQL Tutorial.

Implement a movie database with a web front-end

Create a web form for entering movie information into a database. Also, create a web page that lists in a HTML table all movies that have been entered in the database.

First, create the database:

  • Use the database that is associated with the MySQL account of your group.
  • Create a table named tblMovies, containing the following fields:
id INTEGER automatic unique id
year YEAR(4) nnnn four digit number in the range of 1901 to 2155
genre_id INTEGER see table below
rating INTEGER Your rating of the movie, ranging from 1 to 5 where 5 is best

Create a table named tblGenres, containing the following fields:

id INTEGER automatic unique id
name VARCHAR unique genre name

The tblGenres table should at least contain the following genre names:

  • Action/Adventure
  • Comedy
  • Drama
  • Fantasy/Sci-Fi

The web-form should contain fields for name, year, genre and rating. The genre should be selected from a drop down list with entries fetched from the table tblGenres.

Required features

The following features must be implemented:

  • Ability to enter new movies into the database through a web-form.
  • Ability to edit and delete existing movies from the database through a web-form.
  • Validation of user input, e.g., year/rating field must be numeric and within range.
  • Genre selectable from a drop down list (list of genres given above).
  • Ability to list all entries in the database as a proper looking html table.

Examination of the lab

The examination of this lab is a demonstration of your implementation Note: you might also be asked a few questions about your implementation. Examination will be during the scheduled labs, will typically take 5-15 minutes, and should be attended by all group members. Alternatively, your group's implementation (deployed URL and source code) can be submitted via email to the TAs for examination by 2010-02-05.

The following grades will be given:

  • If your implementation is satisfactory and if your answers to the questions are satisfactory, you will be given the mark "pass" on the Lab. A passed Lab is required to be passed on the course.
  • If your implementation does not work, or if there are obvious annoyances or flaws, or if you fail to answer the questions, you will have to redo and schedule a new examination at a later time.

©- Jan, 2010   Gyozo Gidofalvi