[eluser]Unknown[/eluser]
Hello,
I'm trying to insert lots of records into the database in one go so I want to use the $this->db->insert_batch() functionality. But I get an error message
Code:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: mysql/mysql_driver.php
Line Number: 587
Now I notice that this array works and doesn't give me an error
Code:
$data["1"] = array(
"sku" => 934896,
"title" => "Savannah Barstool",
"description" => "Natural Linen",
"price" => 475.00,
"category" => 22
);
$data["2"] = array(
"sku" => 583401,
"title" => "Coffee table",
"description" => "Steel and Reclaimed Wood",
"price" => 475.00,
"category" => 22,
);
but this test array does create an error. Notice the "dimensions" field. This happens if I add or remove fields from either array. Do both arrays have to have the exact same fields?
Code:
$data["1"] = array(
"sku" => 934896,
"title" => "Savannah Barstool",
"description" => "Natural Linen",
"price" => 475.00,
"category" => 22,
"dimensions" => "22'W x 20'D x 37'H",
);
$data["2"] = array(
"sku" => 583401,
"title" => "Coffee table",
"description" => "Steel and Reclaimed Wood",
"price" => 475.00,
"category" => 22,
);
What is another solution?