Jump to content

Cant add to cart, add a product etc PrestashopDatabaseException


Recommended Posts

I get this error and similar ones if i try to add a product to cart, create a new product, update anything from the back office. Although after this error, the product is created but a custom function i have to be executed after creating a new product doesnt get to execute! Debug mode is set to true.

 

[PrestaShopDatabaseException]

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 'id #90)) GROUP BY c.`id_condition`' at line 4
 

SELECT c.`id_condition`
FROM `ps_condition` c
LEFT JOIN `ps_condition_badge` cb ON cb.`id_condition` = c.`id_condition`
WHERE (c.`calculation_type` = 'hook') AND (c.`calculation_detail` = 'actionObjectCartAddAfter') AND (c.`validated` = 0) AND (cb.`id_badge` IN (Object id #90))
GROUP BY c.`id_condition`

at line 613 in file classes/db/Db.php

 

607.             WebserviceRequest::getInstance()->setError(500, '
 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
608.         }
609.         else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
610.         {
611.             if ($sql)
612.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
613.             throw new PrestaShopDatabaseException($this->getMsgError());
614.         }
615.     }
616.
617.     /**

 

I have updated my mysql from 5.0.77 to 5.0.95. php5.1.6

The annoying thing is this same code works on my test server with same specs but on moving to production i get these errors. Please i need help urgently. The site is live already

 

Please i need help or suggestions... anyone?

Link to comment
Share on other sites

Solved for me this way:

 

since my local installation works correctly and I just uploaded via ftp the whole instalaltion, I ended up it was some server configuration issue. So I compared the local php.ini with the one on the server and made the following changes:

 

short_open_tag=Off (it was ON)

max_input_vars=10000 (this line was missed)

memory_limit=128M (was 32M)

post_max_size=16M (was 8M)

upload_max_filesize=100M (was 2M)

 

I don't know which of these modifications was causing the problem, by the way now I can put products to cart, create a customer account and other things that before generated the DB error message.

 

Hope this helps.

Link to comment
Share on other sites

  • 3 weeks later...

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