I can't quite get my data from an array, it just shows a blank list of list items when I run my foreach loop.
When I print my array it outputs the following:
Array (
[Description] => Array (
[0] => sidewindo
[1] => sidewindo
[2] => sidewindo
[3] => testing )
[comments] => Array (
[0] => sidewindo
[1] => sidewindo
[2] => sidewindo
[3] => testing )
[Fld_id] => 625
[fld_IsPublic] => Array (
[0] => 1 )
[action] => s
[pk_id] => 7 )
My code so far
public function save_data($data)
{
foreach ($data as $row)
{
foreach ($row['Description'] as $show)
{
echo $show;
}
}
And i have tried the following kind of for loop also to retrieve data from the array. I am trying to retrieve data from the array and update it in another table in the database. This code I have written in my model before passing it to the view.
for($i=0;$i<count($comments);$i++)
{
$this->db->update->update('tblname',array('TK_id'=>$data['pk_id'],'Fld_id'=>$data['Fld_id'],'fld_description'=>$data['Description'],'fld_comments'=>$data['comments'],'fld_IsPublic'=>$data['fld_IsPublic']),array('TK_id'=>$data['pk_id'],'Fld_id'=>$data['Fld_id']));
}
}
foreach($data['Description'] as $desc) {}right out in the first loop->update_batch()method in CI, might as well create a group of array in row batches then use that method, much better