note 90126 added to function.ldap-get-entries

From: Date: Tue, 07 Apr 2009 16:09:30 +0000
Subject: note 90126 added to function.ldap-get-entries
Groups: php.notes 
Request: Send a blank email to php-notes+get-152907@lists.php.net to get a copy of this message
Hope this could help a bit others to print attribute and values on the same line. This is basic code of course <?php $ldap_con = ldap_connect($ldap_server) or die("Could not connect to server. Error is " . ldap_error($ldap_con)); $ldap_bd = ldap_bind($ldap_con, $root_dn, $root_pw) or die("Could not bind to server. Error is " .ldap_error($ldap_con)); $result = ldap_search($ldap_con, $personnel_base, "(uid=*)") or die ("Error in query"); $data = ldap_get_entries($ldap_con, $result); for ($i=0; $i<=$data["count"];$i++) { for ($j=0;$j<=$data[$i]["count"];$j++){ echo $data[$i][$j].": ".$data[$i][$data[$i][$j]][0]."\n"; } } ldap_close($ldap_con); ?> ---- Server IP: 213.246.51.26 Probable Submitter: 81.194.27.57 (proxied: 81.194.18.46) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-get-entries.php Edit -- https://master.php.net/note/edit/90126 Del: integrated -- https://master.php.net/note/delete/90126/integrated Del: useless -- https://master.php.net/note/delete/90126/useless Del: bad code -- https://master.php.net/note/delete/90126/bad+code Del: spam -- https://master.php.net/note/delete/90126/spam Del: non-english -- https://master.php.net/note/delete/90126/non-english Del: in docs -- https://master.php.net/note/delete/90126/in+docs Del: other reasons-- https://master.php.net/note/delete/90126 Reject -- https://master.php.net/note/reject/90126 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152907) next »