note 60476 added to function.ldap-next-entry

From: Date: Sun, 08 Jan 2006 12:43:38 +0000
Subject: note 60476 added to function.ldap-next-entry
Groups: php.notes 
Request: Send a blank email to php-notes+get-101398@lists.php.net to get a copy of this message
The code listed below (posted by jeff) to print all attributes with their values is wrong. It keeps trying to index the $entry variable, which is a resource identifier, not an array. All the required information is in the return value of ldap_get_attributes, $attrs. So: $entry = ldap_next_entry($conn,$first_entry); $attrs = ldap_get_attributes($conn,$entry); for ($i=0; $i < $attrs["count"]; $i++) { $attr_name = $attrs[$i]; for ($j=0; $j < $attrs[$attr_name]["count"]; $j++) { echo "$attr_name: ".$attrs["$attr_name"][$j]."\n"; } } ---- Manual Page -- http://www.php.net/manual/en/function.ldap-next-entry.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60476 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60476&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60476&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101398) next »