[php]
$link = connect();
$db = “database”;
$sql=“INSERT INTO database.listings(item_num, filename, title, description, timestamp, pricing, image, seller_id, auction_type, subject, shipping, author, isbn, condition, lbs, oz)
VALUES
(’$item_num’,’$filename’,’$title’,’$description’,’$timestamp’,’$price’,’$image’,’$p_id’,’$auction_type’,’$subject’,’$shiping’,’$author’,
‘$isbn’,’$condition’,’$lbs’,’$oz’)”;
send_sql($sql, $link, $db);
[/php]
This is giving me a mysql syntax error can anyone explain why?
The error message usually provides some indication of the problem. Can you post the actual message?
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 ‘condition, lbs, oz)
VALUES
(‘149’,‘149.php’,‘math time’,‘ok’,‘1312755526’,‘5’,’/’ at line 1
That is my error thanks in advance
“condition” is a reserved word in mySql. It is a good idea to NOT use reserved words as column (or table) names. If you must use a reserved word as a column name, you have to quote it with back-ticks.
... author, isbn, `condition`, lbs, oz)
Thanks David. I did figure this out and you are right. Dam condition is a reserved word.