🧩 Week 9 – MySQL + PHP Integration
Goal: Learn MySQL database basics, SQL commands, and integrate PHP with MySQL to build dynamic web apps.
📚 Daily Outline
Day 1 – MySQL Setup & CRUD Fundamentals
🧠 Topics:
- What is MySQL? Why use it?
- Installing phpMyAdmin via XAMPP
- Creating databases & tables
- SQL basics: SELECT, INSERT, UPDATE, DELETE
🛠 Activities:
- Create a database called blogDB
- Add a table: posts (id, title, body, date)
- Perform CRUD actions using SQL via phpMyAdmin
Day 2 – Relationships, Joins, and Keys
🧠 Topics:
- Primary keys and Auto Increment
- Foreign keys: concept + syntax
- One-to-Many relationships
- INNER JOIN, LEFT JOIN
🛠 Activities:
- Create users table (user\_id, name, email)
- Add foreign key to posts table (user\_id)
- Practice: Query posts with user names using JOIN
Day 3 – PHP + MySQL Connectivity
🧠 Topics:
- MySQLi vs PDO (focus on MySQLi procedural/OOP)
- Connecting PHP to MySQL
- Writing SELECT, INSERT queries from PHP
- mysqli\connect(), mysqli\query(), mysqli\fetch\assoc()
🛠 Activities:
- Build a simple post listing using PHP + DB
- Display database records in a styled HTML table
- Handle errors if DB is not connected
Day 4 – User Authentication System
🧠 Topics:
- Creating login/register forms
- Password hashing (password\hash / password\verify)
- Handling sessions after login
- Protecting dashboard pages
🛠 Activities:
- Create register.php and login.php
- Validate credentials from database
- Build a simple user dashboard with session-based access
Day 5 – Admin Dashboard Functionality
🧠 Topics:
- CRUD posts via dashboard
- Create/Edit/Delete post functionality
- Flash messages using sessions
- Reusing header/footer via includes
🛠 Activities:
- Create dashboard.php with post management
- Add Edit Post functionality
- Show “Post Deleted” or “Updated Successfully” alerts
Day 6–7 – Final Project: Blog CMS with Admin Panel
🎯 Combine all skills:
- Admin login/logout
- Create/Edit/Delete blog posts
- Store posts in MySQL DB
- Secure dashboard with sessions
- Display posts on public index.php
Bonus Ideas:
- Add image upload with posts
- Add categories or tags
- Use Bootstrap for UI styling