[Date Prev][Date Next]
Re: Sorting output to be returned to a HTML page using PHP
On 23 May, Antonin Novak wrote:
> I have also posted this on a PHP mailing list , but to date they
> have not been able to help me.
> I have tried your amendment but I am still getting the same error
I should have looked a bit deeper. There are several issues with what
you are trying to do. I'm assuming the syntax errors are in the email
ldap_get_entries returns a 3-dimensional array of all entries
from that query. The first dimension is each entry and it also contains
a "count" member. There is no key to sort on here. If you are trying to
sort all returned entries and then display them, try something like
the attached file. Note that it needs a bit more error checking (i.e.
what if the entry doesn't have that attribute) for production usage.
Dragon Computer Consultants Inc.
Tel: (416) 708-1578 Fax: (416) 708-8081
$justthese = array ("sn", "givenname");
$sortfield = "uid";
if ($a[$sortfield] == $b[$sortfield])
elseif($a[$sortfield] > $b[$sortfield])
// start at 1 to skip count
for ($i=1; $i<count($info); $i++)
print($info[$i]["dn"] . "<br>\n");
print("-- " . $info[$i]["uid"] . "<br>\n");