note 32957 added to function.ldap-next-entry

From: Date: Wed, 11 Jun 2003 22:24:59 +0000
Subject: note 32957 added to function.ldap-next-entry
Groups: php.notes 
Request: Send a blank email to php-notes+get-50208@lists.php.net to get a copy of this message
dahoo, Your code to list the attributes of an entry isn't as complete as it could be--just listing the $result["attr"][0] value won't handle multiple-valued attributes. Instead, you should have something like: $entry = ldap_next_entry($conn,$first_entry); $attrs = ldap_get_attributes($conn,$entry); for ($i=0; $i < $entry["count"]; $i++) { $attr_name = $entry[$i]; for ($j=0; $j < $entry[$attr_name]["count"]; $j++) { echo "$attr_name: ".$entry["$attr_name"][$j]."\n"; } } This enables you to get listings like: dn: cn=admin,ou=Groups cn: admin objectClass: posixGroup gidNumber: 500 memberUid: 604 memberUid: 605 (note the two values for "memberUid") I hope this helps someone. -Jeff ---- Manual Page -- http://www.php.net/manual/en/function.ldap-next-entry.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32957 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32957&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32957&report=yes

« previous php.notes (#50208) next »