[Date Prev][Date Next] [Chronological] [Thread] [Top]

Sorting output to be returned to a HTML page using PHP



I am wanting to create a list of current users with basic information 
in a HTML form and allow users to access this list and if required  
obtain full details. I am using PHP.3.0.16 to process the 
information.

My code displays a list of users with the required basic 
information. But when I try to sort the information, I get the 
following message.

Variable $a is not an array or string in /www/htdocs/php/zlaty.php3


My code is as follows:- 

 <?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, 
efining $a=array($info) and numerous combinations of array " ( and
info. 

I can not find a way to do the sort using the -S option and 
ldapsearch.

Can anyone let me know how to do this sort.
Any help would be very much appreciated.

Thanks
Tony


----------------------------------------------------------------
 
  Antonin Ch. Novak                    mailto:Antonin.Novak@cca.cz
  Systemovy administrator
  Systemova a technicka podpora
  CCA spol. s r.o.                    Web: http://www.cca.cz
  Kratka 8,  
  301 17 Plzen
  Czech Republic
  
  Tel: +42 019 7221253   
  Fax: +42 019 7222931