嗨,当我在 php 中运行我的代码时,我不断收到 SQL 语法错误,但是当我删除变量并在 MYSQL 中手动执行时,这不是问题。我已经尝试了 2 个不同版本的查询,一个是 ('),另一个是 ("),什么都没有。你能帮忙吗?
谢谢你。
$produpdateid = $_GET ['id'];
$varcat = $_POST['category'];
$vartitle = strip_tags($_POST['title']);
$varoverview = strip_tags($_POST['overview']);
$varfeatures = strip_tags($_POST['features']);
$varspecification = strip_tags($_POST['specification']);
$varmaker = strip_tags($_POST['maker']);
$varsize = $_POST['size'];
$varprice = $_POST['price'];
$varstock = $_POST['stock'];
$vartype = $_POST['stock'];
$q = 'UPDATE products SET products_category_id=' . $varcat . ', title=' . $vartitle . ', overview=' . $varoverview . ', features=' . $varfeatures . ', specification=' . $varspecification . ', size=' . $varsize . ', size_type=' . $vartype . ', maker=' . $varmaker . ', image=' . $varimg . ', price=' . $varprice . ', stock=' . $varstock .' WHERE id=' .$produpdateid;
/*$test = "UPDATE products SET products_category_id=" . $varcat . ", title=" . $vartitle . ", overview=" . $varoverview . ", features=" . $varfeatures . ", specification=" . $varspecification . ", size=" . $varsize . ", size_type=" . $vartype . ", maker=" . $varmaker . ", image=" . $varimg . ", price=" . $varprice . ", stock=" . $varstock ." WHERE id=" .$produpdateid;*/
$updateresult = mysqli_query($dbc,$q);