So now I am passing a json and here is the result of echo '<pre>' . var_export($data, true) . '</pre>';:
array (
0 =>
array (
'booking_id' => 99,
'item_type' => '67',
'sales_item_seq' => '1',
'package_item_id' => '0',
'package_item_seq' => '0',
'package_group' => '0',
'package_group_rowspan' => '0',
'package_group_subdata_rowspan' => '0',
'channel_id' => '380',
'name_of_channel_programme' => '123',
'schedule_from' => '0000-00-00 00:00:00',
'schedule_to' => '0000-00-00 23:59:59',
'no_of_unit' => '123.00',
'exposure_inside_per_unit' => '',
'exposure_duration' => '123',
'advertising_offier' => '0.00',
'special_discount' => '0',
'net' => '0.00',
't_n_c' => '',
'remark' => '',
'status' => '1',
'create_datetime' => '2018-11-14 17:00:33',
'update_datetime' => '2018-11-14 17:00:33',
'channel' => '2',
'package_name' => '',
'sale_item_name' => 'hello',
'cat_id' => '1',
'aftersales_type' => '',
'typing_guide' => '',
'position' => '',
'platform_des' => 'hello',
'nature_des' => 'hello',
'unit_des' => 'Account',
),
...
...
...
9 =>
array (
'booking_id' => 99,
'item_type' => '59',
'sales_item_seq' => '1',
'package_item_id' => '0',
'package_item_seq' => '0',
'package_group' => '0',
'package_group_rowspan' => '0',
'package_group_subdata_rowspan' => '0',
'channel_id' => '0',
'name_of_channel_programme' => 'N/A',
'schedule_from' => '0000-00-00 00:00:00',
'schedule_to' => '0000-00-00 00:00:00',
'no_of_unit' => '123.00',
'exposure_inside_per_unit' => 'N/A',
'exposure_duration' => 'N/A',
'advertising_offier' => '1000.00',
'special_discount' => '100',
'net' => '0.00',
't_n_c' => '',
'remark' => '',
'status' => '1',
'create_datetime' => '2018-11-14 17:00:33',
'update_datetime' => '2018-11-14 17:00:33',
'channel' => '',
'package_name' => '',
'sale_item_name' => 'Service Charge',
'cat_id' => '7',
'aftersales_type' => '',
'typing_guide' => 'N/A',
'position' => 'N/A',
'platform_des' => 'N/A',
'nature_des' => 'Operations',
'unit_des' => 'Campaign',
),
10 =>
array (
'booking_id' => 99,
'item_type' => '0',
'sales_item_seq' => '0',
'package_item_id' => '161',
'package_item_seq' => '0',
'package_group' => '1',
'package_group_rowspan' => '6',
'package_group_subdata_rowspan' => '1',
'channel_id' => '39',
'name_of_channel_programme' => 'hello',
'schedule_from' => '0000-00-00 00:00:00',
'schedule_to' => '0000-00-00 23:59:59',
'no_of_unit' => '1.00',
'exposure_inside_per_unit' => '0',
'exposure_duration' => '',
'advertising_offier' => '180000.00',
'special_discount' => '100',
'net' => '0.00',
't_n_c' => '',
'remark' => '',
'status' => '1',
'create_datetime' => '2018-11-14 17:00:33',
'update_datetime' => '2018-11-14 17:00:33',
'channel' => 'Catch',
'package_name' => 'hello',
'sale_item_name' => 'hello',
'cat_id' => '1',
'aftersales_type' => '',
'typing_guide' => 'Name of Programme',
'position' => '',
'platform_des' => 'hello',
'nature_des' => 'Live',
'unit_des' => 'Live Segment',
'package_id' => '28',
),
...
...
...
'unit_des' => 'Video',
'package_id' => '28',
),
)
It looks fine to me when I view it on an online viewer. and after $this->db->insert_batch('table_name',$data) here is the error returned saying there is Array in the code.
Error Number: 1064
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 'Array' at line 1
And I can find it at the end of the followings (think this is the raw output of the insert_batch):
INSERT INTO `table_name` () VALUES
(
'0.00',
'',
100,
'1',
'2',
'380',
'2018-11-14 17:06:46',
'123',
'',
'67',
'123',
'Access Right',
'0.00',
'123.00',
'0',
'0',
'0',
'0',
'0',
'',
'hello',
'',
'',
'hello',
'1',
'0000-00-00 00:00:00',
'0000-00-00 23:59:59',
'0',
'1',
'',
'',
'Account',
'2018-11-14 17:06:46'
)
,
...
...
...
(
'1000.00',
'',
100,
'7',
'',
'0',
'2018-11-14 17:06:46',
'N/A',
'N/A',
'59',
'N/A',
'Operations',
'0.00',
'123.00',
'0',
'0',
'0',
'0',
'0',
'',
'N/A',
'N/A',
'',
'Service Charge',
'1',
'0000-00-00 00:00:00',
'0000-00-00 00:00:00',
'100',
'1',
'',
'N/A',
'Campaign',
'2018-11-14 17:06:46'
)
,
array
I have no idea why there becomes an array for all the elements from 10 th onwards.
Please let me know if you require more information. Thank you!