Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ubik69/backEndDevelopment/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Primary School Management System provides dedicated view pages for browsing all records in the database. Each view page displays data in a tabular format, retrieved directly from the MySQL database using PHP.Accessing View Pages
Select record type
Choose which type of records you want to view:
- Student
- Parent
- Teacher
- Class
- Contact
- Gym Member
- Salary
All view pages are PHP files that execute database queries when loaded and dynamically generate HTML tables with the results.
Viewing Students
The student view page (ViewStudent.php) displays all student records from the Student1 table.
Student Table Columns
The student table displays the following columns:| Column | Description |
|---|---|
| Student ID | Auto-generated unique identifier (Sid) |
| Student First Name | Student’s first name (Sname) |
| Student Last Name | Student’s last name (Ssurname) |
| Student Birthday | Date of birth (Sbirthday) |
| Student’s Parent ID | Associated parent record (Parent_ID) |
| Student’s Class ID | Associated class record (Class_ID) |
Implementation
The student view page uses this PHP code to fetch and display data:The
fetch_assoc() function retrieves each result row as an associative array, where field names are case-sensitive and match the database column names.Example Student View
When you navigate toViewStudent.php, you’ll see a table like this:
| student ID | Student First Name | Student Last Name | Student Birthday | Student’s Parent ID | Student’s Class ID |
|---|---|---|---|---|---|
| 1 | John | Smith | 2015-03-15 | 5 | 2 |
| 2 | Sarah | Johnson | 2014-07-22 | 6 | 2 |
| 3 | Michael | Brown | 2016-01-10 | 7 | 1 |
Viewing Teachers
The teacher view page (ViewTeacher.php) shows all teacher records with detailed information.
Teacher Table Columns
| Column | Description |
|---|---|
| Teacher ID | Unique identifier (Teacher_ID) |
| Teacher bonus amount | Monetary bonus (bonus_amount) |
| Teacher Field Name | Subject/specialization (teacher_field) |
| Teacher First Name | First name (Tname) |
| Teacher Last Name | Last name (Tsurname) |
| Teacher Address | Residential address (Taddress) |
| Teacher Mobile | Phone number (Tmobile) |
| Teacher Email | Email address (Temail) |
SQL Query
The teacher view executes this query:Teacher records include comprehensive contact information, making it easy to reach staff members when needed.
Example Teacher View
| Teacher ID | Bonus Amount | Field | First Name | Last Name | Address | Mobile | |
|---|---|---|---|---|---|---|---|
| 1 | 500.00 | Mathematics | Jane | Doe | 123 Main St | 555-0101 | jane.doe@school.com |
| 2 | 750.00 | Science | Robert | Wilson | 456 Oak Ave | 555-0102 | r.wilson@school.com |
Viewing Parents
The parent view page (ViewParent.php) displays all parent/guardian records in the system.
Parent Information
Parent records typically include:- Parent ID
- Parent First Name (
Pname) - Parent Last Name (
Psurname) - Parent Address (
Paddress) - Parent Email (
Pemail)
Parent records are linked to student records via the
Parent_ID foreign key in the Student table.Viewing Classes
The class view page (ViewClass.php) shows all class configurations.
Class Information
Class records display:- Class ID
- Class Name/Year (
classYear) - Class Capacity (
capacity) - Assigned Teacher ID (
Teacher_ID)
You can use this view to see which teachers are assigned to which classes and monitor class capacity.
Viewing Contacts
The contacts view page (ViewContact.php) displays all contact form submissions or contact information.
Viewing Gym Members
The gym member view page (ViewGymMember.php) shows students or staff enrolled in gym programs.
Viewing Salaries
The salary view page (ViewSalary.php) displays salary information for teachers.
Salary Information
Salary records typically include:- Teacher ID
- Salary Amount
- Working Type (Part-Time or Full-Time)
How View Pages Work
Database connection established
When you access a view page, PHP first establishes a connection to the MySQL database:
Results retrieved as associative array
Each row is fetched using
fetch_assoc(), which returns an associative array:Table Formatting
All view tables use HTML with CSS styling:Column widths are specified in pixels to ensure consistent layout. Each header includes a horizontal rule (
<hr>) for visual separation.Navigation Between Views
All view pages include the same navigation bar, allowing you to quickly switch between different record types without returning to the home page.The navigation bar is consistent across all pages, making it easy to navigate between Add, View, Delete, and Update operations for any record type.
Troubleshooting
If a view page doesn’t display data:Check database connection
Verify the MySQL connection is established successfully. If connection fails, you’ll see “Connection failed:” message.
Verify table has data
The table might be empty if no records have been added yet. Use the Add menu to create sample records.
Check table and column names
Ensure the SQL query references the correct table and column names (case-sensitive).