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.

The pages

Build exactly these four pages. Do not create any other pages.

PartFileWeight
Global requirementsall pages20%
Studentsstudents.php20%
Coursescourses.php20%
Teachersteachers.php20%
Roomsrooms.php20%

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

Test with these

Your pages must handle every one of these cases correctly.

TestWhat it checks
Student: Billy MacTerrellyTwo 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 DellatorreSemester 2, period 2 has a term 1 course and a term 2 course. Both appear.
Student: Lyndsey AnneslieNo picture: the placeholder appears.
Teacher: Elysia HopkinsSeveral sections in one period, and periods 3-4 courses.
Room: P3Several sections in one period.

Global requirements (20%)

students.php (20%)

Three views:

courses.php (20%)

Three views:

teachers.php (20%)

Two views:

rooms.php (20%)

Two views:

How to approach this assignment

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