Summer Training
Summer Training
MySQL
Web Application
What are Create and Read operations
in CRUD (PHP)?
• CRUD is an acronym for Create, Read, Update, and Delete. As the
name suggests, these operations manipulate data in a database that
is important to any web application’s basic functionality. We can
create a PHP application coupled with a MySQL database to perform
these operations.
Creating a sample table
We will create a sample database and then create a table inside it
named data. The elements will be simple, including a name, id,
and address.
// initializing variables
$name = "";
$address = "";
$id = 0;
$update = false;
if (isset($_POST['save'])) {
$name = $_POST['name'];
$address = $_POST['address'];
Note: You can copy-paste this code above the input form in index.php, and the contents of the database will be displayed.
<?php $results = mysqli_query($db, "SELECT * FROM data"); ?>
<table>
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th colspan="2">Action</th>
</tr>
</thead>
<form>
Source
• https://www.educative.io/answers/what-are-create-and-read-
operations-in-crud-php