Jump to content

Prestashop 1.5. Insert Data into DB problem


bone007

Recommended Posts

Hello,

 

I work on modul for import data (products) to Prestashop.

In that modul I try to use something like this:

Db::getInstance()->insert('specific_price', $insertData)

But it didn't work. Then I realised that my database is without prefix, so I tried to use:

Db::getInstance()->insert('specific_price', $insertData, $null_values = false, $use_cache = true, $type = Db::INSERT, $add_prefix = false)

But with no luck.

Is there some bug in Prestashop or something wrong in my code? Because when I use this script with another Prestashop with database prefix it works perfectly.

 

Version of Prestashop is 1.5.4.1 (please don't tell me to update it's impossible right now)

 

Thanks for any help

Edited by bone007 (see edit history)
Link to comment
Share on other sites

Hi.

 

i will recomend you to write the call without the parameters names on the optional values. Just :

Db::getInstance()->insert('specific_price', $insertData, false, true, Db::INSERT, false)

Are you getting an exception from the function call, or just a "false" as return?

 

Thanks for some point but no luck :(

I got only false return and I have no idea how to debug what is wrong :-/

Link to comment
Share on other sites

Ok, this points that the sql sentence that Prestashop is trying to query is having a bad result (duplicate entry, or similar).

 

Do you have the debug mode active? If not, change

define('_PS_MODE_DEV_', false);

to

define('_PS_MODE_DEV_', true);

on config/defines.inc.php, and perhaps it shows new information about the problem.

Link to comment
Share on other sites

OK,

No I got this:

Fatal error: Uncaught MySQL server has gone away<br /><br /><pre>DELETE FROM `product_group_reduction_cache` WHERE `id_product` = 1</pre> thrown in /public_html/classes/db/Db.php on line 607

Do you know what that error means? I don't have anything like "DELETE group_reduction" in my script.

 

Many thanks

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