ICS4U Assignment 2 - PHP & SQL
In this assignment you build a student information system: four PHP pages that read from the
school database provided.
Due Wednesday Nov. 25, 2026 at the end of class (10:05).
The assignment is locked from your account at exactly the deadline.
Where your files go
/students/studentFolder/XXXXXX/assn2/
XXXXXX is your secret folder. Do not share it with others.
That folder already contains database.php, which connects you to the database.
Example
A working example is provided. Use it to see what each page must do. You may improve the styling or
layout, but the example is the minimum quality expected.
students.php -
courses.php -
teachers.php -
rooms.php
The pages
Build exactly these four pages. Do not create any other pages.
| Part | File | Weight |
| Global requirements | all pages | 20% |
| Students | students.php | 20% |
| Courses | courses.php | 20% |
| Teachers | teachers.php | 20% |
| Rooms | rooms.php | 20% |
Each part is marked on its own Level 1 to 4 scale based on what works. Each level includes everything
in the levels below it. Code commenting, formatting and variable/function naming will move the mark up or down.
Student pictures
- Pictures are in the
/sidpics/ folder, named by student number:
/sidpics/338829286.JPG. The student number is stud_stud_id.
- Some students have no picture. When the file does not exist, show
/sidpics/placeholder.jpg instead.
PHP's file_exists() needs the full path on the server: "/var/www/html/sidpics/...".
Test with these
Your pages must handle every one of these cases correctly.
| Test | What it checks |
| Student: Billy MacTerrelly | Two courses in periods 3-4 of semester 1. Both appear in period 3 and period 4, each with its own room and teacher. |
| Student: Harper Dellatorre | Semester 2, period 2 has a term 1 course and a term 2 course. Both appear. |
| Student: Lyndsey Anneslie | No picture: the placeholder appears. |
| Teacher: Elysia Hopkins | Several sections in one period, and periods 3-4 courses. |
| Room: P3 | Several sections in one period. |
Global requirements (20%)
- Level 1 - All four pages exist and each has the same header in the top right, linking to Students, Courses, Teachers and Rooms.
- Level 2 - Styling is consistent across the pages, and every view has its own heading (
<h1>) as in the example.
- Level 3 - No page or view ever displays a PHP error or warning.
- Level 4 - Everywhere it appears: a student name links to that student's page, a teacher name to that teacher's page,
a course code (section) to that section's page, and a room to that room's page.
students.php (20%)
Three views:
- General view: asks the user to choose a letter.
- Letter view: every student whose last name starts with that letter, sorted by grade.
- Student view: that student's picture and timetable.
- Level 1 - The general view shows the letters, and the letter view lists the students for the chosen letter.
- Level 2 - The letter view is sorted by grade, and each name opens the student view, which shows the student's name and picture (or the placeholder).
- Level 3 - The timetable is a table of semesters and periods. Each period shows the course code, course name, room and teacher. A period with no course is empty.
- Level 4 - Courses in periods 3-4 appear in both periods, two courses in one period both appear (Billy MacTerrelly),
and term 1 and term 2 courses both appear (Harper Dellatorre).
courses.php (20%)
Three views:
- General view: asks the user to choose a letter.
- Letter view: every section whose code starts with that letter, in a table.
- Section view: the students registered in that section.
- Level 1 - The general view shows the letters, and the letter view lists the sections for the chosen letter in a table.
- Level 2 - Each section code opens the section view, which shows the course code, description and teacher's name.
- Level 3 - The section view lists every registered student, in alphabetical order by last name.
- Level 4 - Every student's picture (or the placeholder) appears with their name, laid out as in the example.
teachers.php (20%)
Two views:
- General view: all teachers in a table, to choose from.
- Teacher view: that teacher's timetable, with a "BACK" link in the top left to the general view.
- Level 1 - The general view lists every teacher in a table.
- Level 2 - Each name opens the teacher view, with the teacher's name, the BACK link, and a timetable table of semesters and periods.
- Level 3 - Each period shows the course code, course name and room. A period with no course is empty.
- Level 4 - All sections in one period appear together, and courses in periods 3-4 appear in both periods (Elysia Hopkins).
rooms.php (20%)
Two views:
- General view: all rooms in a table, to choose from.
- Room view: that room's timetable, with a "BACK" link in the top left to the general view.
- Level 1 - The general view lists every room in a table.
- Level 2 - Each room opens the room view, with the room name, the BACK link, and a timetable table of semesters and periods.
- Level 3 - Each period shows the course code, course name and teacher. A period with no course is empty.
- Level 4 - All sections in one period appear together, and courses in periods 3-4 appear in both periods (room P3).
How to approach this assignment
- Create the four pages and the common header first.
- Pass values through links and read them with
$_GET.
Example: <a href='teachers.php?id=42'>Gunnell, Boyd</a>, then $_GET['id'] is 42.
- Look through the database in phpMyAdmin to learn how the data is stored.
- Build each page up slowly, so that you always have a working page. Fix errors at once; do not keep
adding features while a page shows errors.
Appendix: the database
Four tables: students, teachers, sections and registrations.
students
stud_id int -- id used in links: students.php?id=...
stud_stud_id int -- student number, used for the picture filename
stud_lname string
stud_fname string
stud_grade int -- 9 to 12
teachers
teach_id int
teach_lname string
teach_fname string
sections -- one row per class (section) of a course
sect_id int
sect_code string -- Ex: ICS3UD-01
sect_period string -- 1, 2, 3, 4, or 3-4 (one course that fills periods 3 and 4)
sect_room string
sect_term int -- -1 = runs the whole semester
-- 1 or 2 = first or second half of the semester
-- (half-credit courses such as Civics and Careers)
sect_sem int -- 1 or 2
sect_desc string -- course name
sect_teacher int -- teach_id of the teacher
registrations -- one row for each student in each section
reg_id int
reg_sect_id int -- sect_id
reg_stud_id int -- stud_id
Who is in section 42? ... WHERE reg_sect_id = 42
Which sections is student 99 in? ... WHERE reg_stud_id = 99