kirubanidhi Posted September 11, 2017 Share Posted September 11, 2017 (edited) how to resolve this error, Fatal error: Uncaught 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 'Express, `card_number`=0002 WHERE `order_reference` = YPCEAQCDF' in /var/www/html/cy_prestashop/classes/db/Db.php on line 791 ( ! ) PrestaShopDatabaseException: 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 'Express, `card_number`=0002 WHERE `order_reference` = YPCEAQCDF' at line 1<br /><br /><pre>UPDATE `ps_order_payment` SET `transaction_id` =60029436712, `card_brand`=American Express, `card_number`=0002 WHERE `order_reference` = YPCEAQCDF</pre> in /var/www/html/cy_prestashop/classes/db/Db.php on line 791 Code: public function orderPayment_fun($reference,$transaction_id,$card_number,$card_brand){ $value=Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'order_payment` SET `transaction_id` ='.$transaction_id.', `card_brand`='.$card_brand.', `card_number`='.$card_number.' WHERE `order_reference` = '.$reference); if($value){ echo "Updated successful"; }else{ echo "failed"; } die(); } Getting value when order is created but code is not updated to database. Transaction Id 60029436712Card Number 0002Card Brand American ExpressOrder Reference YPCEAQCDF Edited September 11, 2017 by kirubanidhi (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted September 12, 2017 Share Posted September 12, 2017 You should put your values between quotes. Usually Mysql can handle that - although it is not recommended - but in the case of "American Express" it goes wrong. Because there are no quotes it assumes that the value ends with the first space. And then it tries to evaluate "Express" as a new keyword. Link to comment Share on other sites More sharing options...
kirubanidhi Posted September 19, 2017 Author Share Posted September 19, 2017 (edited) I did resolve my problem . I followed below update query in my orderpayment page. Code: $update="UPDATE `ps_order_payment` SET `card_number`='$card_no', `card_brand`='$card_type', `card_expiration`='$card_expire', `card_holder`='$card_holder_name' WHERE `transaction_id`=".(int)$trans_id; return Db::getInstance()->execute($update); Edited September 19, 2017 by kirubanidhi (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now