Laboratory three deals with getting started in MySQL. In this laboratory you will use database tables that have been already created, and explore how to create output by issuing SQL queries on that table, and then processing the resulting output using PHP.
Rename the files you have downloaded to be lookup.php3 and viewSubject.php3 in the local directory. Then find the include file named "connect.inc" in the htdocs directory and copy that to your working directory, or create a symbolic link to it. This include file contains the user name and password for your MySQL account. Now link the MySQL script to your html page, or just load the appropriate URL to access the script.
Note the error message that indicates that there are no data tables to access.
For reference purposees, you can see the script operating in a full version here.
mysql -u cs3ms49 -p<passwd> cs3ms49 < createTable.txt mysql -u cs3ms49 -p<passwd> cs3ms49 < table1.sql.txt mysql -u cs3ms49 -p<passwd> cs3ms49 < table2.sql.txt
Now check the output of the script, and data should be displayed for a number of students.
Eg. ID Surname Subjects ID Surname SubjectsAn example of a page with the appropriate format can be viewed here.
A subsidiary form called viewSubjects.php3 has also been provided above. Download this form, and read through it to understand what it does so far. The link to the index.php3 form is already included, and a parameter sid is used to communicate the student ID to the sub-form. Add in additional code that selects all the SUBJECT_CODE entries for a given student ID from the Subjects data table in MySQL and prints them one below the other in a table.
Once again, refer to the sample solution shown above for an indication of what your solution should do. The student Justin Toomey is a good example to select.