<?php
$id = $_GET[‘id‘];
$conn = new mysqli(‘localhost‘,‘root‘,‘root‘,‘qiye‘);
// 修改数据
if($_POST){
$title = trim($_POST[‘title‘]);
$desc = $_POST[‘descs‘];
$content = $_POST[‘content‘];
$uname = $_POST[‘img‘];
$sql = "update product set title=‘$title‘ , descs=‘$desc‘, img=‘$uname‘, content=‘$content‘ where id=$id";
$res = $conn->query($sql);
if($conn->error){
die($conn->error);
}
if($res){
header(‘location: liebiao.php‘);
}else{
echo $res;
}
}
$sql = "select * from product where id = $id ";
$res = $conn->query($sql);
$info = $res->fetch_assoc();
$conn->close();
?>