Reputation: 25
Array
(
[daterange] => Array
(
[0] => 14/02/2017 - 14/02/2017
[1] => 14/02/2017 - 14/02/2017
)
[location] => Array
(
[0] => dggfd
[1] => hyd
)
[latitude] => Array
(
[0] => 3545
[1] => 111111
)
[longitude] => Array
(
[0] => 43545
[1] => 222222
)
)
zeroth index as one row and 1 index as another row .
Upvotes: 1
Views: 76
Reputation: 15603
Support your array name is $arr
then do this:
$size = sizeof($arr['daterange']);
for($i=0;$i<$size;$i++) {
$data = array(
'daterange' => $arr['daterange'][$i],
'location' => $arr['location'][$i],
'latitude' => $arr['latitude'][$i],
'longitude' => $arr['longitude'][$i],
);
$this->db->insert('table_name',$data);
}
Hope this will help you. Leave the comment if you have any doubts.
Upvotes: 1