如何使用php更新mysql中的多个列
这里我正在尝试使用 php 更新更新 mysql 表中的多个列值.
Here i am trying to update update multiple column values in mysql table using php.
$product_id = mysqli_real_escape_string($link, $_POST['product_id']);
$product_name = mysqli_real_escape_string($link, $_POST['product_name']);
$product_category = mysqli_real_escape_string($link, $_POST['product_category']);
$sql = "UPDATE product_list (product_name, product_category, product_price,product_description,product_size_category) VALUES ('$product_name', '$product_category', '$product_price', '$product_description', '$size_category')";
}"
我有 5 个列值要在表中更新,我正在使用变量来保存数据并使用该变量想要更新表中的值我该怎么做?
i have 5 column values to be updated in table, i am using variable to save data and using that variable want to update the values in table how can i do that?
推荐答案
$sql = "UPDATE `product_list` SET
`product_name` = '$product_name',
`product_category` = '$product_category',
`product_price` = '$product_price',
`product_description` = '$product_description',
`product_size_category` = '$size_category'
where clause..... (if required) ";
相关文章