0
$info = ldap_get_entries($ldap, $search);
   
   for($i = 0; $i < count($info) - 1; $i++)
   {  
      $people =  
         array(
            $i => array(
                  'first' => $info[$i]['givenname'][0],
                  'middle' => $info[$i]['initials'][0],
                  'last' => $info[$i]['sn'][0],
                  'email' => $info[$i]['mail'][0],
                  'username' => $info[$i]['uid'][0]
               )
         );
   }

I have the following code working, but what happens is that the last entry in $info is only entered into $people. What am I doing wrong?

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by chudapati09
0

Nevermind, I figured it out.

$info = ldap_get_entries($ldap, $search);
   
   for($i = 0; $i < count($info) - 1; $i++)
   {  
      $people[$i] =  
         array(
            'first' => $info[$i]['givenname'][0],
            'middle' => $info[$i]['initials'][0],
            'last' => $info[$i]['sn'][0],
            'email' => $info[$i]['mail'][0],
            'username' => $info[$i]['uid'][0]
         );
   }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.