//通过Post方法从已编辑的文本框中获取数据
<?php
if(isset($_POST['submit'])){
include_once('config.php');
$id= $_POST['id'];
$pname= $_POST['product_name'];
$pp= $_POST['price'];
$pcat= $_POST['category'];
$bn= $_POST['brand'];
$pk= $_POST['keywords'];
$pdescr= $_POST['description'];
$pimg= $_POST['image'];
//用于更新或重写表数据的SQL
$query = "UPDATE products SET product_name='$pname',price='$pp,category='$pcat', brand='$bn', keywords='$pk', WHERE id='$id'";
mysqli_query($connect, $query) or die ('Error in insertion');
}
?>
答案 0 :(得分:1)
您的请求中存在一些错误('
缺少一个price
,,
之前不允许一个WHERE
。
$query = "UPDATE products SET product_name='$pname',price='$pp',category='$pcat', brand='$bn', keywords='$pk' WHERE id='$id'";