note 20803 added to function.ldap-get-entries

From: Date: Tue, 16 Apr 2002 17:36:44 +0000
Subject: note 20803 added to function.ldap-get-entries
Groups: php.notes 
Request: Send a blank email to php-notes+get-29448@lists.php.net to get a copy of this message
I noticed the same thing Ron did, except I couldn't get php to return the attribute values using numerical pointers at all. I ended up using an eval() to pass in the associative name: $ds=ldap_connect("ldapserver"); if ($ds) { $r=ldap_bind($ds); #bind to directory $sr=ldap_search($ds,"dc=domain,dc=net", "uid=user"); #search for user print "Number of entires returned is " .ldap_count_entries($ds,$sr)."<p>"; $info = ldap_get_entries($ds, $sr); #get the result print "Data for ".$info["count"]." items returned:<p>"; for ($i=0; $i<$info["count"]; $i++) { #loop though ldap search result print "dn: " . $info[$i]["dn"] . "<br>"; #print dn for ($ii=0; $ii<$info[$i]["count"]; $ii++) { #loop though attributes in this dn print "&nbsp;&nbsp;" . $info[$i][$ii] . ": "; #print attribute name $attrib = $info[$i][$ii]; #set attribute eval("print \$info[\$i][\"$attrib\"][0];"); #print attribute value print "<br>"; } print "<br>"; } ldap_close($ds); } else { echo "<h4>Unable to connect to LDAP server</h4>"; } -- http://www.php.net/manual/en/function.ldap-get-entries.php http://master.php.net/manage/user-notes.php?action=edit+20803 http://master.php.net/manage/user-notes.php?action=delete+20803 http://master.php.net/manage/user-notes.php?action=reject+20803

« previous php.notes (#29448) next »