Hey I have got data in my variable using foreach($report as &rep)
note it is getting things from 4 different table in database
Now when I print my $rep I get the following:
Array
(
[Report] => Array
(
[id] => 246
[emp] => werock
[name] => werock
[organization] => cakephp
[customer] => great
)
[file] => Array
(
[0] => Array
(
[id] => 211
[report_id] => 246
[file_name] =>
[file_type] =>
[file_size] => 0
[file_error] => 4
[file_tag] => 0
)
)
[Engineer] => Array
(
[0] => Array
(
[id] => 232
[report_id] => 246
)
)
[Issue] => Array
(
[0] => Array
(
[id] => 118
[report_id] => 246
[date_created] => 2012-02-10
[status] => wait
)
[1] => Array
(
[id] => 119
[report_id] => 246
[date_created] => 2012-02-10
[status] => debug
)
[2] => Array
(
[id] => 120
[report_id] => 246
[date_created] => 2012-02-10
[status] => Completed
)
)
)
Now what I want to do is access Issues array and check how many array are there in it. in this case 3(0,1,2). and print the value of status for the last index in this case(2).
But when I do $rep[‘Issue’][‘status’] I get Undefined index: status. Can you tell me where I might be going wrong.
What about this:
Let me know if it works.