Update Data File in PHP

 <?php


$stu_id = $_POST["sid"];
$stu_name = $_POST["sname"];
$stu_address = $_POST["saddress"];
$stu_class = $_POST["sclass"];
$stu_phone = $_POST["sphone"];

include "config.php";
$sql = "UPDATE student SET sname = '{$stu_name}',saddress = '{$stu_address}',sclass = '{$stu_class}',sphone = '{$stu_phone}' WHERE sid = '{$stu_id}'";

if ($conn->query($sql) == TRUE) {
    header("Location: http://localhost/crud/index.php");
    echo "New record Updated Successfully";
} else {
    echo "Error : " . $sql . "<br>" . $conn->error;
}
$conn->close();

Comments

Popular posts from this blog

Update Record File in PHP

Index File in PHP

Edit OR Update Data File in PHP