Array question
| From: | Mike Tuller | Date: | Thu, 26 Apr 2001 16:27:02 +0000 |
| Subject: | Array question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-50477@lists.php.net to get a copy of this message | ||
I am trying to pull info from an Exchange LDAP server to make a dynamically
created phonebook, and am having trouble with one field. I think the problem
is that the script I have has everything pulled in an array, and all but the
field I am having problems with are strings. The telephoneNumber would be
integer. Would this cause the telephoneNumber info to not show up when I
view it through a web browser?
Here is the script I have.
<?php
$ldapserver = "myserver.com";
$basedn = "o=myOrganization";
$attribs = array ("cn", "title", "department",
"telephoneNumber");
$dir = ldap_connect($ldapserver)
or die("Failed to connect to LDAP server");
$r = ldap_bind($dir)
or die("Failed binding to server");
$result = ldap_search($dir, $basedn, "sn=T*", $attribs)
or die("Error executing LDAP search");
$info = ldap_get_entries($dir, $result);
print count($info) . "entries returned<br>";
print "<table>";
for ($i=0; $i<$info["count"]; $i++) {
print "<tr>";
print "<td>";
print $info[$i]["cn"][0];
print "</td>";
print "<td>";
print $info[$i]["title"][0];
print "</td>";
print "<td>";
print $info[$i]["department"][0];
print "</td>";
print "<td>";
print $info[$i]["telephoneNumber"][0];
print "</td>";
print "</tr>";
}
ldap_close($dir);
?>