Hey all,
used this site frequently to get me through hard times but this is my first time posting… hopefully someone can help!
I have a page which searches and filters my companies LDAP db and returns several lines of information of multiple people.
I am using foreach and echo to print the data but I can’t seem to figure out how to return the array key i need.
For example… I just want to be able to see the email address of everyone… but instead foreach is returning every line.
[php]
foreach( $info as $v1 ) {
foreach( $v1 as $v2 ) {
foreach ($v2 as $v3 ) {
echo “
”;”;
echo $key ." " .$v3; }}}
echo “
[/php]
This returns:
1 Abbey Road AC 1 John 1 K. 1 [email protected] 1 32412 1 Abbey Road 1 32412 1 Rob 1 [email protected] 1 32412 1 Abbey Road AC 1 Mate 1 Pete 1 [email protected] 1 32412 1 Abbey Road 1 Reeves 1 David 1 [email protected] 1 32412 1 Abbey Road 1 Cross-Tolley 1 Becks 1 [email protected] 1 32412 1 Abbey Road 1 Chris 1 Pile 1 [email protected] 1 32412 1 Abbey Road AC 1 Johnny 1 Borge 1 [email protected] 1 32412 1 Abbey Road 1 Fragoso 1 Pete 1 [email protected] 1 32412 1 Abbey Road 1 Beep 1 Mo 1 [email protected] 1 32412
This is the information: (1 Department 1 First Name 1 Last Name 1 Email 1 Division)
I want to pull just the email, I thought it would look something like this:
[php]
foreach( $info as $v1 ) {
foreach( $v1 as $v2 ) {
foreach ($v2 as $v3 ) {
echo “
”;”;
echo $key ." " .$v3[mail]; }}}
echo “
[/php]
or
[php]
foreach( $info as $v1 ) {
foreach( $v1 as $v2 ) {
foreach ($v2 as $v3[mail] ) {
echo “
”;”;
echo $key ." " .$v3[mail]; }}}
echo “
[/php]
but they don’t work
can anyone help?
Thanks