Skip to main content

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.

Quick Setup

This guide will walk you through setting up and using the Primary School Management System to manage your school’s data efficiently.
1

Access the Admin Panel

Navigate to the admin login page and authenticate with your credentials.
admin_login.php
<form method="post">
    <label for="admin_user">admin user: </label>
    <input required type="text" name="admin_user" /><br /><br />
    <label for="admin_pass">admin password :</label>
    <input required type="password" name="admin_pass" /><br /><br />
    <input type="submit" name="submit">
</form>
Keep your admin credentials secure. Only authorized personnel should access the management system.
2

Navigate to the Dashboard

After successful login, you’ll be directed to the main dashboard (index.html) where you can access all management features through the navigation menu.The navigation bar provides four main operations:
  • View - Browse existing records
  • Add - Create new entries
  • Delete - Remove records
  • Update - Modify existing data
3

Configure Database Connection

Ensure your database connection is properly configured. The system uses MySQLi for database operations.
$link = mysqli_connect(
    "your-host.com",
    "your-username",
    "your-password",
    "your-database"
);

// Check connection
if ($link === false) {
    die("Connection failed: ");
}
Update the connection parameters in all PHP files to match your database configuration.

Managing Students

Adding a New Student

To add a student to the system:
1

Navigate to Add Student

Click AddStudent from the navigation menu to access the student registration form.
2

Fill in Student Details

Complete the required fields:
  • Student First Name
  • Student Last Name
  • Birthday (must be a past date)
  • Parent ID (existing parent record)
  • Class ID (existing class record)
AddStudent.html
<label for="Sname">Student Name:*</label>
<input type="text" required name="Sname"><br /><br />

<label for="Ssurname">Student Lastname:*</label>
<input type="text" required name="Ssurname"><br /><br />

<label for="Sbirthday">Student Birthday:*</label>
<input type="date" required max="2023-04-06" name="Sbirthday" /><br /><br />

<label for="Parent_ID">Parent ID:* </label>
<input type="text" required name="Parent_ID"><br><br>

<label for="Class_ID">Class ID:*</label>
<input type="text" required name="Class_ID"><br>
3

Submit the Form

Click the submit button. The system will process the data using AddStudent.php:
AddStudent.php
if (isset($_POST['submit'])) {
    $Sname = $_POST['Sname'];
    $Ssurname = $_POST['Ssurname'];
    $Sbirthday = $_POST['Sbirthday'];
    $Parent_ID = $_POST['Parent_ID'];
    $Class_ID = $_POST['Class_ID'];

    $send = "INSERT INTO Student1 
             (Sname,Ssurname,Sbirthday,Parent_ID,Class_ID) 
             VALUES ('$Sname','$Ssurname','$Sbirthday',
                     '$Parent_ID','$Class_ID')";
    
    if (mysqli_query($link, $send)) {
        echo "New record created successfully";
    } else {
        echo "Error adding record ";
    }
}

Viewing Students

Access the student list by clicking ViewStudent:
ViewStudent.php
$sql = mysqli_query($link, "SELECT Sid,Sname,Ssurname,Sbirthday,Parent_ID,Class_ID FROM Student1");

while ($row = $sql->fetch_assoc()){
    echo "
    <tr>
        <th>{$row['Sid']}</th>
        <th>{$row['Sname']}</th>
        <th>{$row['Ssurname']}</th>
        <th>{$row['Sbirthday']}</th>
        <th>{$row['Parent_ID']}</th>
        <th>{$row['Class_ID']}</th>
    </tr>";
}
This displays all students in a formatted table with their ID, name, birthday, parent, and class information.

Updating Student Records

To modify student information:
  1. Navigate to UpdateStudent
  2. Enter the Student ID and new information
  3. Submit the form
UptadeStudent.php
if (isset($_POST['submit'])) {
    $Sid = $_POST['Sid'];
    $Sname = $_POST['Sname'];
    $Ssurname = $_POST['Ssurname'];
    $Sbirthday = $_POST['Sbirthday'];

    $uptade = "UPDATE Student1 
               SET Sname = '$Sname',
                   Ssurname = '$Ssurname',
                   Sbirthday='$Sbirthday' 
               WHERE Sid= '$Sid'";
    
    if(mysqli_query($link,$uptade)){
        echo "Record has been uptaded.";
    } else {
        echo "Error uptading record.";
    }
}

Deleting Students

To remove a student record:
  1. Navigate to DeleteStudent
  2. Enter the Student ID
  3. Confirm deletion
DeleteStudent.php
if(isset($_POST['submit'])){
    $Sid = $_POST['Sid'];
    $delete = "DELETE FROM Student1 WHERE Sid=$Sid";
    
    if(mysqli_query($connection,$delete)){
        echo "Record has been deleted.";
    } else {
        echo "Error deleting record.";
    }
}
Deletion is permanent. Ensure you have the correct Student ID before confirming deletion.

Managing Teachers

Adding a Teacher

Navigate to AddTeacher and fill in the teacher information form:
AddTeacher.php
if (isset($_POST['submit'])) {
    $bonus_amount = $_POST['bonus_amount'];
    $teacher_field = $_POST['teacher_field'];
    $Tname = $_POST['Tname'];
    $Tsurname = $_POST['Tsurname'];
    $Taddress = $_POST['Taddress'];
    $Tmobile = $_POST['Tmobile'];
    $Temail = $_POST['Temail'];

    $sql = "INSERT INTO Teacher 
            (bonus_amount,teacher_field,Tname,Tsurname,
             Taddress,Tmobile,Temail) 
            VALUES ('$bonus_amount','$teacher_field','$Tname',
                    '$Tsurname','$Taddress','$Tmobile','$Temail')";
    
    if (mysqli_query($link, $sql)) {
        echo "New record created successfully";
    } else {
        echo "Error adding record ";
    }
}
Teacher records include specialization fields and bonus amounts for compensation tracking.

Managing Parents

Adding a Parent

Parents must be added before students can be associated with them:
AddParent.html
<form method="post" action="AddParent.php">
    <label for="Pname">Parent First Name:</label>
    <input required type="text" name="Pname"><br><br>
    
    <label for="Psurname">Parent Last Name:</label>
    <input required type="text" name="Psurname"><br><br>
    
    <label for="Paddress">Parent Address</label> <br>
    <textarea required name="Paddress" cols="50" rows="10"></textarea><br><br>
    
    <label for="Pemail">Parent Email:</label>
    <input type="email" name="Pemail"><br>
    
    <input type="submit" name="submit">
</form>

Managing Classes

Creating a Class

Classes require a year name, capacity, and assigned teacher:
AddClass.php
if (isset($_POST['submit'])) {
    $classYear = $_POST['classYear'];
    $capacity = $_POST['capacity'];
    $Teacher_ID = $_POST['Teacher_ID'];

    $sql = "INSERT INTO Class (classYear,capacity,Teacher_ID) 
            VALUES ('$classYear','$capacity','$Teacher_ID')";
    
    if (mysqli_query($link, $sql)) {
        echo "New record created successfully";
    } else {
        echo "Error adding record ";
    }
}

Viewing Classes

The class view displays all classes with their capacity and assigned teacher:
ViewClass.php
$sql = mysqli_query($link, "SELECT Class_ID, classYear, capacity, Teacher_ID FROM Class");

while ($row = $sql->fetch_assoc()){
    echo "
    <tr>
        <th>{$row['Class_ID']}</th>
        <th>{$row['classYear']}</th>
        <th>{$row['capacity']}</th>
        <th>{$row['Teacher_ID']}</th>
    </tr>";
}

Managing Salaries

Processing Teacher Salaries

Track teacher compensation based on working hours:
AddSalary.php
if (isset($_POST['submit'])) {
    $Teacher_ID = $_POST['Teacher_ID'];
    $salary_amount = $_POST['salary_amount'];
    $workingTimes = $_POST['workingTimes'];

    $sql = "INSERT INTO Salary (Teacher_ID,salary_amount,workingTimes) 
            VALUES ('$Teacher_ID','$salary_amount','$workingTimes')";
    
    if (mysqli_query($link, $sql)) {
        echo "New record created successfully";
    } else {
        echo "Error adding record ";
    }
}
Salary records are linked to teachers via the Teacher_ID foreign key. Ensure the teacher exists before creating salary records.

Best Practices

Data Entry Guidelines

Required Fields

Always complete all required fields marked with asterisks (*) to ensure data integrity.

Foreign Keys

Verify that Parent IDs, Class IDs, and Teacher IDs exist before referencing them in other records.

Data Validation

Use appropriate date formats and validate email addresses to maintain clean data.

Regular Backups

Implement regular database backups to prevent data loss.

Common Operations Workflow

  1. New Student Enrollment:
    • Add parent record first
    • Create/verify class exists
    • Add student with parent and class references
  2. New Teacher Setup:
    • Add teacher record with contact details
    • Assign teacher to a class
    • Set up salary record
  3. Class Organization:
    • Create class with capacity
    • Assign a teacher
    • Enroll students up to capacity limit

Security Recommendations

The current implementation has several security considerations:
  1. SQL Injection - Use prepared statements instead of direct query concatenation
  2. Password Security - Implement password hashing (bcrypt/Argon2)
  3. Session Management - Add proper session handling for authenticated users
  4. Input Validation - Sanitize all user inputs before database operations
  5. HTTPS - Always use HTTPS in production environments

Next Steps

Now that you’re familiar with the basic operations:
  • Explore the View pages to see all existing records
  • Practice adding, updating, and deleting records
  • Familiarize yourself with the navigation structure
  • Review the database schema to understand entity relationships
For additional support or to report issues, use the Contact Us page accessible from the main navigation menu.

Troubleshooting

Common Issues

Connection Failed Error
  • Verify database credentials are correct
  • Check that the database server is accessible
  • Ensure MySQLi extension is enabled in PHP
Record Not Created
  • Verify all required fields are filled
  • Check for foreign key constraint violations
  • Ensure proper data types match database schema
Authentication Failed
  • Confirm admin credentials are correct
  • Check that the admin_login table exists and has valid records
  • Verify database connection is established before authentication attempt

Build docs developers (and LLMs) love