Sorry to have to bother you again.

I am wanting to create a telephone list of all users on a LDAP database. I have managed to extract the data, but cannot get the code to sort the results in alphabetic order , based on surname.

My code is:-

<?php {
$ds=ldap_connect("localhost");
if ($ds)
$r=ldap_bind($ds);
$justthese = array ("sn", "givenname);
$sr=ldap_search($ds,"dc=xxx,dc=yy","sn=*");

$info=ldap_get-entries($ds,$sr);

function EntryCompare($a,$b)
{
$sortfield = "sn";
if($a[$sortfield]==$b[$sortfield])
{
return 0;
}

if($a[$sortfield]>$b[$sortfield])
{
return 1;
}
else
{
return -1;
}
}


uksort($info,EntryCompare);

for ($i=0, $i<$info["count"]; $i++)
{
echo statement
}

I have tried the sort statement within the "for" statement, defining $a=array($info) and numerous combinations of array " ( and
info.

I have tried [0] at various places .

I have now exhausted my limited programmin knowledge, and would very much appreciate any help that anyone can give.

Thanks

Tony