Post by moneycarlo » Tue May 12, 2020 2:05 am

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'");

Active Member


Wed Sep 28, 2011 3:40 am

Post by straightlight » Tue May 12, 2020 4:03 am

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

Straightlight Administrator / Quality Assurance Analyst / Programmer / Opencart Tester

Legendary Member


Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by » Fri Jul 17, 2020 4:30 pm

just put print for ur composed query and check once is there any syntax missing in your code.

New member


Thu Jun 04, 2020 2:10 pm
Who is online

Users browsing this forum: No registered users and 5 guests