my array is (coming from database)
Array ( [0] => Array ( [date] => 2011-05-12 [user_id] => 48 ) [1] => Array ( [date] => 2011-05-31 [user_id] => 77 ) [2] => Array ( [date] => 2011-05-03 [user_id] => 318 ) [3] => Array ( [date] => 2011-05-20 [user_id] => 619 ) [4] => Array ( [date] => 2011-05-21 [user_id] => 619 ) [5] => Array ( [date] => 2011-05-25 [user_id] => 619 ) [6] => Array ( [date] => 2011-05-28 [user_id] => 619 ) [7] => Array ( [date] => 2011-05-11 [user_id] => 747 ) [8] => Array ( [date] => 2011-05-12 [user_id] => 747 ) [9] => Array ( [date] => 2011-05-29 [user_id] => 747 ) [count] => 10 )
and when i use
foreach($appVenueAmbassador as $kk => $venueUserId){
$unique[] = $appVenueAmbassador[$kk]['user_id'];
}
on that query then i get
Array ( [0] => 48 [1] => 77 [2] => 318 [3] => 619 [4] => 619 [5] => 619 [6] => 619 [7] => 747 [8] => 747 [9] => 747 [10] => )
means last element is coming blank
how can i solve this problem ?
That would be because the last element is
[count] => 10and doesn’t have auser_id. You should be seeing a warning regarding this if you’d switch on error reporting. Also, the way you’re grabbing that value is quite overcomplicated. Try this: