Delete data in database File in PHP

 <?php

include("dbconn.php");

if (isset($_GET["id"])) {
    $idnew = $_GET["id"];
}

$sql = "DELETE FROM students WHERE id = '$idnew'";

if ($conn->query($sql) == TRUE) {
    header("location:index.php?delete_msg=YOU HAVE SUCCESSFULLY DELETED DATA");
} else {
    die("Query Failed : " . $conn->error);
    echo "Error : " . $sql . "<br>" . $conn->error;
}
$conn->close();

Comments

Popular posts from this blog

Index File in PHP