Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Issues displaying Multidimensional Array using php and ADldap plugin

Posted on 2014-04-01
7
Medium Priority
?
303 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 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

721 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