Update
Update 1
<?php
// connect to the bookdb database
$pdo = require_once 'connect.php';
$publisher = [
'publisher_id' => 1,
'name' => 'McGraw-Hill Education'
];
$sql = 'UPDATE publishers
SET name = :name
WHERE publisher_id = :publisher_id';
// prepare statement
$statement = $pdo->prepare($sql);
// bind params
$statement->bindParam(':publisher_id', $publisher['publisher_id'], PDO::PARAM_INT);
$statement->bindParam(':name', $publisher['name']);
// execute the UPDATE statment
if ($statement->execute()) {
echo 'The publisher has been updated successfully!';
}
Update general
<html>
<head>
<style>
input{
width: 40%;
height:40px;
border-radius:15px;
border-color:#F00;
font-family:"Phetsarath OT";
font-size:18px;
color:#00C;
text-align:center;
}
#button{
width: 30%;
height:50px;
background-color:#009;
border-radius:8px;
border-bottom:5px solid #FFF;
font-family:"Phetsarath OT";
font-size:20px;
color:#FF0;}}
</style>
</head>
<body>
<?php
include('DBC.php');
$dd = $_GET['Edit'];
$sql = "select * from login where Password = '$dd'";
$query = mysqli_query($con, $sql);
if($query){
if($row=mysqli_fetch_assoc($query)){
?>
<center>
<form method="post" enctype="multipart/form-data">
<input type="text" name="u1" value="<?php echo $row['User']; ?>" ><br><br>
<input type="text" name="u2" value="<?php echo $row['Password']; ?>" ><br><br>
<input type="text" name="u3" value="<?php echo $row['Status']; ?>" ><br><br>
<input type="submit" name="update" value="ແກ້ໄຂ" id="button">
</form></center>
<?php
try{
if(isset($_POST['update'])){
$pp1=$_POST['u1'];
$pp2=$_POST['u2'];
$pp3=$_POST['u3'];
$sq ="update login set User = '$_POST[u1]', Password = '$_POST[u2]', Status = '$_POST[u3]' where Password = '$pp2' ";
$query = mysqli_query($con, $sq);
if($query){
header("refresh:0; LoginRe.php");
}
else{echo'Not Update';}
}
}
catch(Exception $ex){}
} }?>
</body>
</html>