[lug] alpha sort for ldap query in php

Atkinson, Chip CAtkinson at Circadence.com
Tue Oct 31 15:55:08 MST 2000


How about these:
http://www.php.net/manual/html/function.ksort.html
http://www.php.net/manual/html/function.array-multisort.html 
http://www.php.net/manual/html/function.sort.html


> -----Original Message-----
> From: Andrew Diederich [mailto:andrew at NETdelivery.com]
> Sent: Tuesday, October 31, 2000 3:50 PM
> To: 'blug'
> Subject: [lug] alpha sort for ldap query in php
> 
> 
> I'm trying my hand at a (very) little php scripting.  The one 
> thing I wanted
> to do was grab name/email/phone info out of an MS exchange 
> ldap directory.
> I go the basics down (the query happens, tables appear with 
> the right data,
> etc.) but it isn't sorted alphabetically.  It seems to be 
> sorted in the
> order that the users were added to exchange.  
> 
> Does anyone know a good way to alphabatize this?  Right now 
> my table entries
> look like the below.  I stole much of this from the php 
> website.  I took out
> the actual <table> bits to make this email a little shorter.
> 
> $ds=ldap_connect("host.name"); // must be a valid LDAP server!
> if ($ds) {
>         $r=ldap_bind($ds);      // this is an "anonymous" 
> bind, typically
>                                 // read-only access
> $dn="";
> $sr=ldap_search($ds, $dn, "objectclass=organizationalperson");
> $info = ldap_get_entries($ds, $sr);
> $info = ldap_get_entries($ds, $sr);
> for ($i=0; $i<$info["count"]; $i++) {
>         echo "<tr>\n<td>".$info[$i]["cn"][0]."</td>\n";
>         echo "<td>".$info[$i]["telephonenumber"][0]."</td>\n";
>         echo "<td>".$info[$i]["mail"][0]."</td>\n";
>         echo "<td>".$info[$i]["title"][0]."</td>\n";
>         echo "</tr>\n\n";
> }
> 
> Any ideas?
> --
>     Andrew Diederich
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> 




More information about the LUG mailing list