Here, we will write a program in php to update data in Mysql. Considering we have created the connection, database and the table with some data inside it.
update.php
<?php
$msg="";
$css_class="";
if(isset($_POST["update"]))
{
if(mysqli_query($db,"update student_details set Name='$_POST[name]', Phone_number='$_POST[contact]', DOJ='$_POST[doj]',image_path='$profileImagename' where st_id=$id")){
$msg="User saved to database";
$css_class="alert-success";
}else{
$msg="failed to save data to the database";
$css_class="alert-danger";
}
?>
<script type="text/javascript">
window.location="index.php";
</script>
<?php
}
?>