Jump to content

Fatal error: Uncaught Db->executeS() must be used only with select, show, explain or describe querie


Recommended Posts

je veux executer une requete dans un fichier ajax mais j'ai reçu tjrs cet erreur 

Fatal error: Uncaught Db->executeS() must be used only with select, show, explain or describe queries thrown in C:\wamp\www\prestashop1.6.1.11\classes\db\Db.php on line 638

 

contenu du fichier ajax.php

 

<?php

include_once('../../config/config.inc.php');
if(Tools::getValue("method")){
switch(Tools::getValue("method")){
case 'select_c1':
$tab_category = Db::getInstance()->ExecuteS('select  ca.`id_category`, CONCAT(parent.name, ' > ', calang.`name`) as name,
IFNULL(SUM(t.`totalQuantitySold`), 0) AS totalQuantitySold,
ROUND(IFNULL(SUM(t.`totalPriceSold`), 0), 2) AS totalPriceSold
 
FROM `ps_category` ca
LEFT JOIN `ps_category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = 1 AND calang.id_shop = 1 )
LEFT JOIN `ps_category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = 1 AND parent.id_shop = 1 )
LEFT JOIN `ps_category_product` capr ON ca.`id_category` = capr.`id_category`
LEFT JOIN (
SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold`, pr.id_category_default
FROM `ps_product` pr
LEFT JOIN (
SELECT pr.`id_product`,
IFNULL(SUM(cp.`product_quantity`), 0) AS totalQuantitySold,
IFNULL(SUM(cp.`original_product_price` * cp.`product_quantity`), 0)  AS totalPriceSold, pr.id_category_default
FROM `ps_product` pr
LEFT OUTER JOIN `ps_order_detail` cp ON pr.`id_product` = cp.`product_id`
LEFT JOIN `ps_orders` o ON o.`id_order` = cp.`id_order`
AND o.id_shop IN (1) 
WHERE o.valid = 1
and o.current_state =4
AND o.invoice_date BETWEEN "2017-01-01 00:00:00" and "2017-12-31 00:00:00"
GROUP BY pr.`id_product`
) t ON t.`id_product` = pr.`id_product`
) t ON t.`id_product` = capr.`id_product` and t.id_category_default =ca.id_category
WHERE ca.id_category IN (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 12, 13, 14, 15)
GROUP BY ca.`id_category`
HAVING ca.`id_category` != 1');
echo json_encode( array('tab_category' => $tab_category ));
break;
}
}
?>
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...