Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Issues displaying Multidimensional Array using php and ADldap plugin

Posted on 2014-04-01
7
Medium Priority
?
307 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 35

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 35

Accepted Solution

by:
gr8gonzo earned 1500 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
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.
Suggested Courses

824 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