NYCPHP Meetup

NYPHP.org

[nycphp-talk] Retrieving LDAP data on DN of specific record

Randal Rust randalrust at gmail.com
Thu Dec 21 10:40:14 EST 2006


In my LDAP system, I can display all organizations. From that list, I
need to link to a summary page. I have been trying to do this by
passing the DN in the query string, and then using this function to
retrieve the data:

	function viewOrganization($db, $value){
		global $display;
		$rs=ldap_read($db->ds, $db->dn, '(dn='.$value.')');
		if(!$rs){
			$display->errors=true;
			$display->errorM.='<p><strong>ERROR: '.ldap_error($ds).'</strong></p>';
			}
		if(!$display->errors){
			$info = ldap_get_entries($db->ds, $rs);
			print_r($info);
			}
		}

The problem is that if I pass the DN, $info is always empty.

If I modify things so that I pass the value of the custom RECORDID
attribute, then it works fine. So why can't I retrieve on the DN?

-- 
Randal Rust
R.Squared Communications
www.r2communications.com



More information about the talk mailing list