I am having a little difficulty getting a form to upload to a SQL database. basically I am a noob, but I found two different codes that I wanted to put together to make this all work. the form is for a product upload and it has numerous fields including a field for a file upload for a picture. Now after filling out the form and hitting the submit button it goes to the page that has the scripts to process the data. I am not having troubles with script that handles the file and puts it into the directory that I want, but I am having trouble with the script that uploads the data from the form to SQL.
It is telling me an error:
ERROR: 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 'group, brand, vendor, descrip, saleprice, cost, sizes, colors, INSERT INTO products(name, code, group, brand, vendor, descrip, saleprice, cost, sizes, colors, picture) VALUES('Cotton Shirt','test-123','2','3','1','this is just a test run','25.00','15.00','L,','','C:\PHP\uploadtemp\php2048.tmp')
I am not sure what it is and I made sure that I did not change the syntax from the script I found online unless he was wrong on his script. Here is the script it is refering to:
<?php
// writes to SQL table all the form information
if ($REQUEST_METHOD=="POST") {
$SQL = "INSERT INTO products";
$SQL = $SQL . "(name, code, group, brand, vendor, descrip, saleprice, cost, sizes, colors, picture) VALUES";
$SQL = $SQL . "('$prodname','$code','$group','$brand','$vendor','$descrip','$saleprice','$cost','$sizes','$colors','$userfile')";
$result = mysql_db_query($database_mrlogo,"$SQL",$mrlogo);
if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }
else
echo ("New Product Added\n");
}
mysql_close($mrlogo);
?>
Can someone help point out what could be wrong with this syntax so I can breath again 🙁
Thanks for any help you guys can give 🙂