Page 525 - Computer_Science_F5
P. 525
Computer Science Building a task management web (b) Within task_manager, create a table
Activity 8.28:
named tasks with fields: id (INT,
Primary Key, Auto Increment),
application with PHP, PDO, and
task_name (VARCHAR(255)),
MySQL
FOR ONLINE READING ONLY
TINYINT defaulting to 0).
Aim: and is_completed (BOOLEAN or
To develop proficiency in PHP
and PDO for performing CRUD Step 2: PHP application setup:
operations on a MySQL database (a) Create index.php for listing tasks.
while creating a functional web-based
task management application. (b) Create add_task.php for adding new
tasks.
Materials: (c) Create update_task.php for updating
1. Computers with Internet access task completion status.
2. Web server environment (Such as (d) Create delete_task.php for deleting
XAMPP, WAMP, or any web server
with PHP and MySQL support) tasks.
3. Text editor or IDE for PHP Step 3: CRUD Operations:
development
4. MySQL database management tool (a) Create (Add new task): Implement
(Such as phpMyAdmin) a form in add_task.php to insert
5. Sample data for testing (optional) new tasks into the tasks table using
PDO.
Instructions (b) Read (List tasks): Query all tasks
Create a practical web application in index.php and display them
using PHP and PDO to perform in a list format showing task
CRUD operations on a MySQL names and completion status.
database. Develop a “Task List” Include functionality for “Mark
application where users can manage as Completed/Not Completed”,
tasks by adding new tasks, viewing a
list of tasks with status, updating task “Edit”, and “Delete”.
status, and deleting tasks. This activity (c) Update (Mark task as completed/
aims to understand PHP and PDO for not completed): Develop logic
database interactions, practice CRUD in update_task.php to toggle the
operations, and build a basic but completion status of tasks based
functional web application using PHP.
on user interaction.
Step 1: Database setup (d) Delete (Remove a Task): Implement
(a) Create a MySQL database named functionality in delete_task.php to
task_manager. delete tasks from the tasks table.
516
for Advanced Secondary Schools
Computer Science Form 5.indd 516 23/07/2024 12:35

