I am trying to put different variables into a database on the same line. when i use insert into without the where clause, the script puts the $quantity2 variable on a new line in the database. so i tried update in a few ways including using WHERE ID=’$id’. i keep getting the following error:
error uploading content: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(Bolts_6in_zinc) VALUES (’-2’) WHERE product=‘2ply_Dom’’ at line 1
Here is the code, any help would be appreciated.
[php]<?php
require_once(‘functions.php’);
require_once(‘config.php’);
connect();
///Specs 1
$specs_product1= make_safe($_POST[‘product1’]);
$add=“INSERT INTO product_specs (product) VALUES (’$specs_product1’)”;
if (!mysql_query($add)) {
die('error uploading content: ’ . mysql_error());
}
//////////////SPEC 2
if(empty($_POST[‘quantity2’])) {}
else {
$specs_product2= make_safe($_POST[‘product2’]);
$specs_quantity2= make_safe($_POST[‘quantity2’]);
$quantity2= $specs_quantity2 * -1;
$id=mysql_insert_id();
$add=“UPDATE product_specs (” . $specs_product2 . “) VALUES (’” . $quantity2 . "’) WHERE product=’$specs_product1’ ";
if (!mysql_query($add)) {
die('error uploading content: ’ . mysql_error());
}
}
?>[/php]