I have a customer model with the following function:
public function add($data)
{
$this->db->insert_batch('customers', $data);
}
Using this function in localhost on a 5.6 php environment works without any problem. On server with 7.0 php environment I receive the error:
<p>Severity: Warning</p>
<p>Message: array_keys() expects parameter 1 to be array, boolean given</p>
<p>Filename: database/DB_query_builder.php</p>
<p>Line Number: 1549</p>
<h1>A Database Error Occurred</h1>
<p>Error Number: 1136</p><p>Column count doesn't match value count at row 1</p><p>INSERT INTO `customers` () VALUES ('John Doe', '25', 'Male'), ('Brad Doe', '22', 'Male')</p><p>Filename: models/Customers_model.php</p><p>Line Number: 22</p>
Well, I dunno why the final query has no column names, since my $data
content is perfect.
public function add($data)
{
print_r($data);
$this->db->insert_batch('customers', $data);
}
The output:
Array
(
[0] => Array
(
[name] => 'John Doe'
[age] => 25
[sex] => 'Male'
)
[1] => Array
(
[name] => 'Brad Doe'
[age] => 22
[sex] => 'Male'
)
)
And finally my server configuration on Cpanel