我有这段代码,由于某种原因,我收到了这个错误
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's','Used','A Book','1','http://media1.' at line 2
代码:
if(empty($_POST['image'])) {
$file = 'http://media1.site.org/products/images/no-photo.jpg';
} else {
define('UPLOAD_DIR', '/products/images/');
define('UPLOAD_HOST', 'http://media1.sabinalcanyon.org/products/images/');
move_uploaded_file($_FILES['image']['tmp_name'],UPLOAD_DIR.$_FILES['image']['name']);
$file = UPLOAD_HOST.$_FILES['image']['name'];
}
$descedit = "<p>".$_POST['description']."</p>";
mysql_query("INSERT INTO products (`title`,`barcode`,`ISBN`,`catagory`,`set_price_start`,`brand`,`condition`,`description`,`amount_stock`,`picurl`)
VALUES('$_POST[title]','$_POST[barcode]','$_POST[ISBN]','$_POST[catagory]','$_POST[set_price_start]','$_POST[brand]','$_POST[condition]','$descedit','$_POST[amount_stock]','$file')") or die(mysql_error());
第 2 行只是这段代码的开始。