DELETE Query is MySql using PHP ?


The delete query is used to delete record from the table.

we need to insert whose information we want to delete from database.

we need to create a page for entering values in the table.(delete.php)
 <!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>View data for</title>
 </head>
 <body>
 <form name="f" method="POST"  action="delete_action.php">
 Enter roll<input type="text" name="t1">
 <input type="submit">
 </body>
 </html>

Deleting information in the database table.

Connectivity page for deleting values in the database.(delete_action.php)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Connectivity Page</title>
</head>
<body>
<?php
  $r=$_REQUEST["t1"];
  $servername="localhost";
  $username="root";
  $password="";
  $db="project";   */suppose project is our database name. */
  $conn=mysqli_connect($servername,$username,$password,$db);
  if(!$conn)
  {
   echo"not connected";
  }
  $q="DELETE FROM `table1` WHERE roll=$r";  */ suppose table1 is our table name. */
  $qu=mysqli_query($conn,$q);
  ?>
</body>
</html>