Hi
I'm trying to 'echo' the output from my LDAP search so it shows in the order I want, not what the LDAP outputs.
This is a clip of my code:
$sector and $key are passed to the query..
$dn = "cn=Unit";
$filter="(&(objectclass=*)(|(|(|(id=$sector[$key])(id=$sector2[$key])(id=$sector3[$key])(id=$sector4[$key])))))";
$justthese = array('cn','id');
$sr=ldap_search($ds, $dn, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
for ($n=0; $n<$info['count']; $n++) {
$usr = $info[$n]['cn'][0];
$id = $info[$n]['id'][0];
if ($id==$sector[$key]) $dist="Sector ";
if ($id==$sector2[$key]) $dist="Sector 2 ";
if ($id==$sector3[$key]) $dist="Sector 3";
if ($id==$sector4[$key]) $dist="Sector 4";
echo " " .$dist . " - " .$usr ."<br>";
}
The output can show as:
Sector - UserName
Sector3 - UserName
Sector4 - UserName
Sector2 - UserName
OR
Sector - UserName
Sector4- UserName
Sector3 - UserName
Sector2 - UserName[/QUOTE]
Instead of :
Sector - UserName
Sector2 - UserName
Sector3 - UserName
Sector4 - UserName
So how do I 'echo' my output to show in the order I choose ???
Thanks