Solved

Undefined index Error - PHP LDAP

Posted on 2008-10-17
4
427 Views
Last Modified: 2013-12-19
I'm using php to display users from the LDAP and i'm trying to output their usernames, so i am using this piece of code:
    for ($i=0; $i < $entries["count"]; $i++)
    {
        echo $entries[$i]["sAMAccountName"][0]."<br />";
    }

Although this produces the following error for each user:
Notice: Undefined index: sAMAccountName in C:\xampp\htdocs\test4.php on line 45

Using 'displayname' works. Anyone know what is causing this?

Thanks.
0
Comment
Question by:alumwell
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 22739814
Try the column name "SAMAccountName", maybe that helps
0
 

Author Comment

by:alumwell
ID: 22741030
Unfortunatly not. Just tried it. Thanks.

Anyone got any suggestions?

Thanks.
0
 
LVL 9

Accepted Solution

by:
Sander Stad earned 500 total points
ID: 22755791
I had a script that had the same problem ones and I looked it up and I changed the column to the following name "samaccountname" all in lower case.
At this script to your code to see all the results maybe that can help you:
 

foreach ($entries[$i] as $k => $v) {

    echo "Key is ".$k;

}

Open in new window

0
 

Author Closing Comment

by:alumwell
ID: 31507081
Worked. Thanks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP and Soap 3 30
get radio button vale in array 7 37
Exchange 2010 Mailbox Database offline 2 59
Post xml via PHP Soap Client 3 15
This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

14 Experts available now in Live!

Get 1:1 Help Now