Post by AlsusArt » Thu Jul 04, 2013 7:24 am

Hi, i am keep getting this error. Can you help me to fix it?

Code: Select all

Error: You have an error in your SQL syntax;chceck the manual that corresponds to your MySQL server version for the right syntax to use near 'op LEFT JOIN ocpp`order` o ON (op.order_id = o.order_id) WHERE o.customer_id = " at line 1 
Error No: 1064 
SELECT COUNT (*) AS total FROM ocpp`order_product` op LEFT JOIN ocpp`order` o ON (op.order_id = o.order_id) WHERE o.customer_id = '15' AND op.product_id =  '4887' AND o.order_status_id =  '5' in/home/www_innjewel/system/database/mysql.php on line 49 
I think that problem is in this part of code.

Code: Select all

$query = $this->db->query("SELECT op.product_id, COUNT(*) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);
or

Code: Select all

$sql = "SELECT COUNT(DISTINCT p.product_id) AS total FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id)";

Newbie

Posts

Joined
Thu Jul 04, 2013 6:33 am
Who is online

Users browsing this forum: No registered users and 1 guest