bubble_chart StackLab

Php PDO CRUD Speedrun

9 steps · pending Not started · person_outline Guest
arrow_back Back

Final Database Relationship

The complete application works around this relationship:

code text
┌──────────────┐
│   STUDENTS   │
│              │
│ student_id   │
└──────┬───────┘
       │
       │ 1
       │
       │ many
       ▼
┌──────────────┐
│    BORROW    │
│              │
│ borrow_id    │
│ student_id   │
│ book_id      │
│ borrow_date  │
│ return_date  │
└──────┬───────┘
       │
       │ many
       │
       │ 1
       ▼
┌──────────────┐
│    BOOKS     │
│              │
│ book_id      │
│ book_title   │
│ book_author  │
└──────────────┘
The important concept is that borrow does not duplicate student or book information. Instead, it stores their IDs:
code text
student_id → students.student_id
book_id    → books.book_id
This is why the JOIN query is required when displaying readable borrow information. ---

Summary

The application demonstrates three separate CRUD systems.

Students

code text
Create Student
Read Students
Update Student
Delete Student

Books

code text
Create Book
Read Books
Update Book
Delete Book

Borrow

code text
Borrow Book
Read Borrow Records
Return Book
Delete Borrow Record
The most important SQL commands are:
code sql
INSERT
SELECT
UPDATE
DELETE
The most important PDO methods are:
code php
prepare()
execute()
query()
fetch()
fetchAll()
Together, these provide the basic foundation for building PHP applications that interact with MySQL databases using PDO.

login Sign in to save your progress permanently. info Progress is saved in your browser session
format_list_numbered Step 9 of 9