Jump to content

You have an error in your SQL syntax


Recommended Posts

Bonjour,

Depuis quelques jours j'ai une erreur qui est apparu lorsque je fait un nouveau produit et les associations ne sont pas sauvgardées.

Quel pourrait-être la cause de cela ?

Merci à vous.

Voici le message d'erreur : 

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 ') ON DUPLICATE KEY UPDATE id_product=2203,taric=' at line 1
 

INSERT INTO ps_vm_taric (id_product,taric) VALUES (2203,) ON DUPLICATE KEY UPDATE id_product=2203,taric=
Link to comment
Share on other sites

oui il manque la fin, donc sans doute un caractère non-échappé qui fait tout planter.

Cette requête n'est pas native Prestashop donc voir dans vos modules instllés qui doit s'appeler vm_taric quelque chose et regarder son code dans le hook productUpdate

Link to comment
Share on other sites

  • 9 months later...

je viens d'avoir la même, ça vient d'un module vendu chez Jeckyl  : Presta2expinet

qui gère les codes "taric" pour la douane, il faut modifier le fichier presta2expinet.php en rajoutant un test pour voir si la variable est vide.

à partir de la ligne 519 pour la fonction suivante :

    public function hookActionProductUpdate($params) {
        $id_product = Tools::getValue('id_product');
		$taric = pSQL(Tools::getValue("taric"));
		if (isset($taric) && $taric != '') {
			$sql = 'INSERT INTO '. _DB_PREFIX_ .'vm_taric (id_product,taric) VALUES ('.(int)$id_product.','.$taric.') ON DUPLICATE KEY UPDATE id_product='.(int)$id_product. ',taric='.$taric.'';
			Db::getInstance()->execute($sql);
		}
    }

voilà..

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...