The School Demo Project is a PHP and MySQL-based web application for managing students and classes. It features CRUD operations for students, including image uploads, and class management. The project is styled with Bootstrap for a modern, responsive design. Students' details, including class names, are dynamically displayed using SQL JOIN queries. The application includes secure file handling, form validation, and an intuitive user interface. Designed for educational purposes, it demonstrates core concepts of web development, database integration, and server-side programming.
- Home Page: List all students with their details and options to view, edit, or delete them.
- Create Student: Add a new student with an image upload.
- View Student: View a student's full details.
- Edit Student: Update a student's information and optionally upload a new image.
- Delete Student: Remove a student and their image from the server.
- Manage Classes: Add and list all available classes.
- Install XAMPP on your Windows 10 system.
- Install a code editor like Visual Studio Code (VS Code).
- Basic understanding of PHP and MySQL.
- Start the Apache and MySQL services from the XAMPP Control Panel.
- Open
http://localhost/phpmyadminin your browser. - Create a new database named
school_db. - Execute the following SQL script to create the required tables:
CREATE TABLE student ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255), address TEXT, class_id INT, image VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE classes ( class_id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
- Clone or download this repository.
- Place the folder
school_demoinside thehtdocsdirectory of your XAMPP installation (C:\xampp\htdocs\school_demo). - Ensure the folder structure is as follows:
school_demo/ ├── db.php ├── index.php ├── create.php ├── view.php ├── edit.php ├── delete.php ├── classes.php ├── uploads/ (make this directory writable)
- Open the
db.phpfile. - Update the following details if they differ in your setup:
$host = "localhost"; $username = "root"; $password = ""; $dbname = "school_db";
- Open your browser and navigate to:
http://localhost/school_demo/ - Use the application to manage students and classes.
- db.php: Database connection file.
- index.php: Home page listing all students.
- create.php: Form to create a new student.
- view.php: View details of a single student.
- edit.php: Form to edit a student's information.
- delete.php: Deletes a student and their image.
- classes.php: Manage class names.
-
Uploads directory:
- Ensure the
uploads/directory exists and has write permissions. - All uploaded images will be stored here.
- Ensure the
-
Image Validation:
- Only
jpgandpngfile formats are allowed.
- Only
-
Styling:
- The project uses Bootstrap for responsiveness and visual appeal.
- Error: Database connection failed:
- Verify your
db.phpcredentials. - Ensure the
school_dbdatabase exists in phpMyAdmin.
- Verify your
- Images not uploading:
- Check if the
uploads/folder has write permissions.
- Check if the