Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find data when results set is in array?

i want to find data through id, i have an array like that

$result= 

 Array
 (

   [3] => 536371014
   [38] => 1435902884
   [53] => 100000224980743
)

user _id is

  [3], [38], [53]

in my user tabe

    user_id    name 
     3          usii
     38         test
     53         test 2

i want to find all data through user id, how can i do that with the result set user id which is index, i tried alot but didn't get success, please help me to do that, thanks a ton in advance.

like image 763
usii Avatar asked May 07 '13 07:05

usii


1 Answers

Use foreach like this

foreach($result as $val) {

   echo $val[$user_id];
}
like image 164
chandresh_cool Avatar answered Sep 18 '22 00:09

chandresh_cool