Exercise: Simple User Management System
bjective:
O
Create
a
simple
web
application
using
PHP
and
MySQL
that
allows
users to perform CRUD operations on a list of users.
Requirements:
1. Database Setup:
- Create a MySQL database named `user_management`.
-
Inside
this
database,
create
a
table
called ̀users`
with
the
following columns:
- `id` (INT, AUTO_INCREMENT, PRIMARY KEY)
- `name` (VARCHAR(100))
- `email` (VARCHAR(100))
- `created_at` (TIMESTAMP, default to current timestamp)
2. PHP Setup:
- Create a PHP file `db.php` to handle the database connection.
-
Create
a
main
PHP
file
named̀index.php`
that
will
serve
as
the
interface for managing users.
3. Interface:
-
Home
Page
(`index.php`): Displaya
list of
allusersfrom the
̀users` table with options to Edit or Delete each user.
-
AddUserForm: Include
aformat
thetopof
thepageto
add a
new user (Name and Email).
-
Edit
User Form:When
theuser
clickstheEditlink,
theyshould
be able to update the selected user’s Name and Email.
-
Delete User:
When
the
user
clicks
the
Delete link,
the
user
should be removed from the database.
4. Testing:
-
Test
the
application
by
adding
multiple
users
and performing
CRUD operations.
-
(Optional): Extend
the application
by
adding features like
form
validation,
search
functionality,
and
user
authentication.
Ali Mantache - Full Stack Developer Instructor - 2024
1