The aim of this lab is to introduce you to the development of database-backed PHP applications using MySQL.
Download, install and test the prime minister database search example (assoc-mysql.zip) on dwarf.
This version stores the prime minister database as an array of
associative arrays as before. But it also contains some database
access functions in file includes/db_defs.php and an SQL
file for creating and populating a MySQL table pms in file
sql/pms.sql.
First, create and populate the table pms in MySQL.
Then, carefully reread the section on user-defined queries in the PHP and MySQL lecture notes
Finally, modify the function search() in file
includes/defs.php to construct an SQL query from the
parameter $query to perform the database search, and test
it thoroughly. You should then have a working database search example
(but without the ability to modify the database).
.
Remember that a well-written solution will link the same external style sheet to every page of the application, will validate and sanitise user input (the query), and will be well-commented and laid out.
Remember also to observe the application requirements from Lab 3 for all PHP applications form now on.
Complete the List Detail example (list-detail.zip) by implementing the delete and update operations.
This is a key task for Assignment 1.
Complete Tasks 1 and 2.