Solved

Issues displaying Multidimensional Array using php and ADldap plugin

Posted on 2014-04-01
7
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
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…

622 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