Updating data
<html>
<form method="POST">
id: <input type="text" name="id"><br>
name:<input type="text" name="n1"><br>
<input type="submit" name="s" value="update"><br>
view student details<a href="dis.php">click here</a>
</form>
<?php
$conn=mysqli_connect('localhost','root','','student');
if($conn->connect_error)
die("connection failed".$conn->connect_error);
echo "connection successful";
if(isset($_POST['s']))
$id=$_POST['id'];
$n=$_POST['n1'];
$sql="update stud_details set s_name='$n' where s_id='$id'";
if(mysqli_query($conn,$sql)){
echo "updated successfully";
else
echo "error";
}
?> <html>
<form method="POST">
id: <input type="text" name="id"><br>
name:<input type="text" name="n1"><br>
<input type="submit" name="s" value="update"><br>
view student details<a href="dis.php">click here</a>
</form>
<?php
$conn=mysqli_connect('localhost','root','','student');
if($conn->connect_error)
die("connection failed".$conn->connect_error);
echo "connection successful";
if(isset($_POST['s']))
$id=$_POST['id'];
$n=$_POST['n1'];
$sql="update stud_details set s_name='$n' where s_id='$id'";
if(mysqli_query($conn,$sql)){
echo "updated successfully";
else
echo "error";
}
?>
Deleting data
<html>
<form method="POST">
id: <input type="text" name="id"><br>
<input type="submit" name="s" value="delete"><br>
</form>
<?php
$conn=mysqli_connect('localhost','root','','student');
if($conn->connect_error)
die("connection failed".$conn->connect_error);
echo "connection successful";
if(isset($_POST['s']))
$id=$_POST['id'];
$sql="delete from stud_details where s_id='$id'";
if(mysqli_query($conn,$sql)){
echo "deleted successfully";
else
echo "error".$connect_error;
<html>
<form method="POST">
id: <input type="text" name="id"><br>
<input type="submit" name="s" value="delete"><br>
</form>
<?php
$conn=mysqli_connect('localhost','root','','student');
if($conn->connect_error)
die("connection failed".$conn->connect_error);
echo "connection successful";
if(isset($_POST['s']))
$id=$_POST['id'];
$sql="delete from stud_details where s_id='$id'";
if(mysqli_query($conn,$sql)){
echo "deleted successfully";
else
echo "error".$connect_error;