Solved

Issues displaying Multidimensional Array using php and ADldap plugin

Posted on 2014-04-01
7
288 Views
Last Modified: 2014-04-01
I am pulling member data out of a Active directory group using

$groupinfo = $adldap->group()->info('group', array('member'));

Open in new window


I would like to display the count but am having issues echoing the data. Below is what the array looks like. How would the echo code look like. Been working on this and can' figure it out.

Array
(
    [0] => 1
    [1] => Array
        (
            [member] => Array
                (
                   [count] => 23
                    [0] => Data
                    [1] => Data
                    [2] => Data
                    [3] => Data
                    [4] => Data
                    [5] => Data
                    [6] => Data
                    [7] => Data
                    [8] => Data
                    [9] => Data
                    [10] => Data
                    [11] => Data
                    [12] => Data
                    [13] => Data
                    [14] => Data
                    [15] => Data
                    [16] => Data
                    [17] => Data
                    [18] => Data
                    [19] => Data
                    [20] => Data
                    [21] =>Data
                    [22] => Data
                )

            [0] => member
            [count] => 1
            [dn] => Data
        )

)

Open in new window

0
Comment
Question by:ats2012
  • 5
  • 2
7 Comments
 
LVL 34

Expert Comment

by:gr8gonzo
Comment Utility
echo $groupinfo[1]["member"]["count"];
0
 

Author Comment

by:ats2012
Comment Utility
I tried that combination and this is the error I receive

 SCREAM: Error suppression ignored for
( ! ) Notice: Undefined offset: 1 in E:\wamp\www\ats\citrix_xenapp.php on line 36
Call Stack
#	Time	Memory	Function	Location
1	0.0004	146088	{main}(  )	..\citrix_xenapp.php:0

Open in new window

:
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 500 total points
Comment Utility
According to the data you posted, that is the correct path. If you're looping through multiple groups, it may be that some entities don't have that path. You can always check it with isset() first:

if(isset($groupinfo[1]["member"]["count"]))
{
  echo $groupinfo[1]["member"]["count"];
}
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:ats2012
Comment Utility
The Array is being printing using print_r so this is correct but it still spits out that error. I don't get it.
0
 

Author Comment

by:ats2012
Comment Utility
This is only looking at one group.
0
 

Author Comment

by:ats2012
Comment Utility
Interesting if I use:

echo $groupinfo[0]["member"]["count"];

This is the output:

23Array
0
 

Author Comment

by:ats2012
Comment Utility
I got this working now. Its a 0 instead of 1. Not sure why.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now