getting rid of NOTICE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have this short script (below) that does checking whether a userid has an associated jpegPhoto in an LDAP database. The script is working fine but gave a 'Notice' msg bcos I made error_reporting to report all errors.

Notice: Undefined index: jpegphoto in test.php on line 34

Question: How do I make the Notice go away without changing error reporting to error_reporting (E_ALL & ~E_NOTICE) ?

Please advise.

--
roger

<?
require_once "config.inc";
error_reporting (E_ALL);

$ds = @connectBindServer(LDAP_RDN, LDAP_PASS);
if ($ds) {
    $what2return   = array("givenName","sn","jpegPhoto");
    $searchFilter  = "(uid=roger@xxxxxxxxxxx)";
    $sr            = ldap_search($ds, LDAP_BASEDN, $searchFilter,$what2return);
    $resultEntries = ldap_get_entries($ds, $sr);
    closeConn($ds);

    if ($resultEntries["count"] == 0) {
        print "user not found";
        exit;
    }
    else {
        $gn        = $resultEntries[0]["givenname"];
        $sn        = $resultEntries[0]["sn"];
        $photo     = $resultEntries[0]["jpegphoto"];
        if ($photo['count'] == 1)
            print "photo available";
        else
            print "photo not available";
    }
}

?>



---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux