Page 1 of 1

help with mysql query

Posted: Tue May 12, 2020 2:05 am
by moneycarlo
I'm trying to tweak an ocmod I did a long time back and I'm adding a mysql query but am having problems with the syntax, wondering if anyone could help me out? I think it's something with the quotes in the code=shipping part but all the variations i' ve tried have failed me so far..

the working mysql version is:

Code: Select all

SELECT * FROM order_total WHERE order_id = 123 AND code = "shipping";
I'm trying to get it into the PHP (with order_id variable) and am having issues near the =shipping part. I was trying something like:

Code: Select all

("SELECT * FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "' . " AND code = 'shipping'");
Thanks!

Re: help with mysql query

Posted: Tue May 12, 2020 4:03 am
by straightlight
Try in PHPMyAdmin first, without the DB_PREFIX and replace the $order_id with the actual number to test your query prior to run it into Opencart.

Re: help with mysql query

Posted: Fri Jul 17, 2020 4:30 pm
by i.am.retailer
just put print for ur composed query and check once is there any syntax missing in your code.