Hi I keep getting SQL syntax error when i'm running my code in php, however when i remove the variables and do it manually in MYSQL, not a problem. I've tried 2 different versions of query one with (') and other with (") and nothing. Could you please help?
Thank you.
$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);