ldap_errno
(PHP 4, PHP 5)
ldap_errno — Return the LDAP error number of the last LDAP command
Description
int ldap_errno
( resource $link_identifier
)
Parameters
-
link_identifier
-
An LDAP link identifier, returned by ldap_connect().
Return Values
Return the LDAP error number of the last LDAP command for this
link.
Examples
Unless you lower your warning level in your php.ini sufficiently or
prefix your LDAP commands with @ (at) characters to suppress warning
output, the errors generated will also show up in your HTML output.
Example #1 Generating and catching an error
<?php
$ld = ldap_connect("localhost");
$bind = ldap_bind($ld);
$res = @ldap_search($ld, "o=Myorg, c=DE", "objectclass");
if (!$res) {
echo "LDAP-Errno: " . ldap_errno($ld) . "<br />\n";
echo "LDAP-Error: " . ldap_error($ld) . "<br />\n";
die("Argh!<br />\n");
}
$info = ldap_get_entries($ld, $res);
echo $info["count"] . " matching entries.<br />\n";
?>