I'm adding an address data to my query.
$insert_row = $mysqli->query("INSERT INTO `order` (BuyerName,BuyerEmail,BuyerAddress,TransactionID,DateTime,ItemAmount,) VALUES ('$buyerName','$buyerEmail','$BuyerAddress','$transactionID','$date', '$ItemTotalPrice')");
before adding the $BuyerAddress
it works just fine. but after i change the query i get
Error : (1064) 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 ') VALUES ('Amin black','testcart2@gmail.com','Level 01, No 1, First Avenue' at line 2
this is how i get address data
$BuyerAddress = urldecode($httpParsedResponseAr["SHIPTOSTREET"])
.' '.urldecode($httpParsedResponseAr["SHIPTOCITY"])
.' '.urldecode($httpParsedResponseAr["SHIPTOSTATE"])
.' '.urldecode($httpParsedResponseAr["SHIPTOZIP"])
.' '.urldecode($httpParsedResponseAr["SHIPTOCOUNTRYNAME"]);
Can anyone tell me whats wrong with it? or am i combining the address the wrong way?
remove comma after ItemAmount
in you query-field-list
$insert_row = $mysqli->query("
INSERT INTO `order`
(BuyerName, BuyerEmail, BuyerAddress, TransactionID, DateTime, ItemAmount)
VALUES
('$buyerName', '$buyerEmail', '$BuyerAddress', '$transactionID', '$date', '$ItemTotalPrice')
");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.