Solved

Issues displaying Multidimensional Array using php and ADldap plugin

Posted on 2014-04-01
7
295 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
ID: 39969644
echo $groupinfo[1]["member"]["count"];
0
 

Author Comment

by:ats2012
ID: 39969994
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
ID: 39970036
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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

Author Comment

by:ats2012
ID: 39970057
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
ID: 39970059
This is only looking at one group.
0
 

Author Comment

by:ats2012
ID: 39970086
Interesting if I use:

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

This is the output:

23Array
0
 

Author Comment

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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

770 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