Program to delete data from table using PHP in mysql.

Here, we will write a program in php to delete data in Mysql. Considering we have created the connection, database and the table with some data inside it.

delete.php file

<?php
$db=mysqli_connect("localhost","root","",) or die(mysqli_error($db));
mysqli_select_db($db,"vsitdb") or die(mysqli_error($db));

$id=$_GET["id"];
mysqli_query($db,"delete from student_details where st_id=$id");

 ?>
 <script type="text/javascript">
 window.location="index.php";
 </script>