PHP Check Session if one has privilege -
i'm working on mysql query create product in database i'm getting error:
you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'desc, fprice, inkoop, image, author, html) values('1', 'bronze 5 - bronze 4', '1' @ line 1
i have googled can't find problem in code:
<?php if(isset($_post['submit'])) { $shopid1 = $_post['productid']; $prodname1 = $_post['productname']; $desc1 = $_post['desc']; $fprice1 = $_post['fprice']; $price1 = $_post['price']; $inkoop1 = $_post['inkoop']; $image1 = $_post['image']; $qty1 = $_post['qty']; $html1 = $_post['html']; $author1 = $_session['name']; mysql_query("insert products(shopid, name, qty, price, desc, fprice, inkoop, image, author, html) values('$shopid1', '$prodname1', '$qty1', '$price1', '$desc1', '$fprice1', '$inkoop1', '$image1', '$author1', '$html1')", $conn) or die(mysql_error()); header("location: products.php"); } else { } ?>
hope can diagnose problem! thanks!
desc
reserved keyword. try -
insert products(shopid, name, qty, price, `desc`,.....
or rename accordingly.
Comments
Post a Comment