is there a possibility to retrieve a search from
an ldap search (for my case) which is in done php <?......?>
outside of it
to the body of my page?

to have a general idea i try to create a table that will be
completed dynamically from the search being done inside the php...

is that possible...?

example:

        $dn = $info[$j]["dn"];
        $filter=("cn=*");
        $sr=ldap_list($ldapconn, $dn, $filter, $attrs);
        $users=ldap_get_entries($ldapconn, $sr);
         $x=0;

    while ($x<=$users["count"]){
    if ($users[$x]["objectclass"][0]=="posixGroup"){

    echo '<span>';
    echo $users[$x]["cn"][0];
    echo '<br />';
    echo '<img src="../images/sitemap2b.gif" border="0px"/>';
    echo '</span>';
    echo '<br />';

    }

INTO A TABLE

<p>Available students</p>     
    <table>
        <li id="$a counter"> .$search result. </li>

smting like that i have in mind...

Recommended Answers

All 7 Replies

is there a possibility to retrieve a search from
an ldap search (for my case) which is in done php <?......?>
outside of it
to the body of my page?

to have a general idea i try to create a table that will be
completed dynamically from the search being done inside the php...

is that possible...?


example:

$dn = $info[$j]["dn"];
			$filter=("cn=*");
			$sr=ldap_list($ldapconn, $dn, $filter, $attrs);
	   		$users=ldap_get_entries($ldapconn, $sr);
			 $x=0;
		
		while ($x<=$users["count"]){
		if ($users[$x]["objectclass"][0]=="posixGroup"){
		
		echo '<span>';
		echo $users[$x]["cn"][0];
		echo '<br />';
		echo '<img src="../images/sitemap2b.gif" border="0px"/>';
		echo '</span>';
		echo '<br />';
		
		}

INTO A TABLE

<p>Available students</p>		
		<table>
			<li id="$a counter"> .$search result. </li>

smting like that i have in mind...

Please use code tags in the future. As to your request, should be simple enough with the right var... :)

$output = "";
$dn = $info[$j]["dn"];
$filter=("cn=*");
$sr=ldap_list($ldapconn, $dn, $filter, $attrs);
$users=ldap_get_entries($ldapconn, $sr);
$x=0;

while ($x<=$users["count"]){
if ($users[$x]["objectclass"][0]=="posixGroup"){

$output .= '<span>';
$output .= $users[$x]["cn"][0];
$output .= '<br />';
$output .= '<img src="../images/sitemap2b.gif" border="0px"/>';
$output .= '</span>';
$output .= '<br />';

}

<p>Available students</p>	
<?php echo $output; ?>

See where I am going with that?

My 2¢. Hope it helps.

so this i sgoing ot work as a buffer ...?

the think is that the search is being done inside php
and i use echo in every line...
should i replce it ?

(sorry about the code tags..)

.....

and it happends as i said ...
i lose my search result and also i otn have anything after that to the body
where it is supposed to be the output...

thanks though....any other opinion

+ i think that because of that certain search (ldap )
uses a counter
the table should be filled dynamically...

so this i sgoing ot work as a buffer ...?

the think is that the search is being done inside php
and i use echo in every line...
should i replce it ?

If it were me, yes. And yes, it kind of acts like a buffer. It holds the search results until you are ready to display them.

(sorry about the code tags..)
.....

Don't sweat it. I forget them from time to time, as well. :)

and it happends as i said ...
i lose my search result and also i otn have anything after that to the body where it is supposed to be the output...

In the code above, the string ($output) starts blank.
Then, during the loop where you were echoing the information, we are sticking the information into the string using concatenation.
After the loops are over, the results from the search are contained inside the string ($output), and can be echoed anywhere in the script that you see fit, using the style shown in the previous code, like:

<?php echo $output; ?>

Hope this clarifies things a bit.

thanks for the reply ...
is not working and as i said it shows me nothing...
on the table below the php

thanks for the reply ...
is not working and as i said it shows me nothing...
on the table below the php

When you were using the echos, were they displaying data?

yes the hole schema of the ldap is right in front of me ...
i tried to use output and echos but then i couldnt open the page
and i had to rename the file remotely from the server...

Good morning from greece it worked
but i justed used the following parts....

$dn = $info[$j]["dn"];
			$filter=("cn=*");
			$sr=ldap_list($ldapconn, $dn, $filter, $attrs);
	   		$users=ldap_get_entries($ldapconn, $sr);
			 $x=0;
 
		while ($x<=$users["count"]){
		if ($users[$x]["objectclass"][0]=="posixGroup"){
 
		echo '<span>';
		echo $users[$x]["cn"][0];
		echo '<br />';

and then

<?php 
$b=0;

while ($b<=$stud["count"]){
	echo '<li id=node1>';
echo $stud[$b]["cn"][0]; 
	echo '</li>';
$b++;
}

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.