Lab Manual For Introduction To Database: Lab 7:view, Update and Delete Operation Using Web Interface
Lab Manual For Introduction To Database: Lab 7:view, Update and Delete Operation Using Web Interface
Contents
1. Introduction 3
4. Concept Map 3
4.2 Operation 4
5. Tools 4
5.1 Setting-up and Setting up XAMPP (MySQL, Apache) [Expected time = 5mins] 4
7. Evaluation Criteria 17
8. Practice Tasks 17
a. Task 01 17
b. Outcome 17
• http://www.htmlcodetutorial.com/ 18
1. Introduction
As you have remember about the insert operation which we have done in lab 4, now in this lab,
we will perform Complete CRUD operation.
4. Concept Map
For CRUD operation we have used the student database which we have created in lab 4. Now
first we established a connection then we performed all the operation.
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$databasename=”database name”;
// Create connection
$conn = mysqli_connect($servername, $username, $password,$databasename);
// Check connection
Department of Computer Science, Page 3
C.U.S.T
Lab 7:View, Update and Delete Operation using Web Interface
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
4.2 Operation
In a walkthrough section we have performed all CRUD operation using web interface.
5. Tools
In this section tools installation and setup is defined.
• Computer
• Microsoft Windows 10 operating system
• Internet Browser(Internet Explorer, Mozilla Firefox or Google Chrome etc.)
• Notepad
5.1 Setting-up and Setting up XAMPP (MySQL, Apache) [Expected time = 5mins]
Output :
4) Write the following HTML code in it and save the file with name first.php
5) Create a new file for CSS and save with name style.css
Input:
Output:
Output:
Output:
After creating the delete button delete action code in process.php file like shown in figure:
Output:
Now you can see record 3 and 5 deleted just by clicking delete button.
Output:
After creating edit button, now when we click on edit button the current row data will place in
form for editing and save button replace by update button. For this we have to modify the
first.php file like shown in figure.
Output:
Now update the data in update form and click on Update button. To update the data in
database you must add update code in process.php file like shown in figure.
We have updated the address of a Hassan student, replace Islamabad by Lahore and clicked on
update button. The data updated successfully in database which is shown in figure.
7. Evaluation Criteria
The evaluation criteria for this lab will be based on the completion of the following tasks. Each
task is assigned the marks percentage which will be evaluated by the instructor in the lab whether
the student has finished the complete/partial task(s).
8. Practice Tasks
a. Task 01
First you will create an Employee database and employee information table. Then you have to
create an interface for taking input employee information and save them in database.
b. Outcome
After completing this lab, students will be able to perform some functionality using PHP and also
understand the concept of web application development using PHP.
1 6 ProceduresandTools 0
2 7.1 Practicetask1withTesting 15
5 8 EvaluationTasks(Unseen) 80
6 GoodProgrammingPractices 5
TotalMarks 100
• http://www.htmlcodetutorial.com/