?
Solved

Undefined index Error - PHP LDAP

Posted on 2008-10-17
4
Medium Priority
?
450 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
[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
  • 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 1500 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
The viewer will learn how to dynamically set the form action using jQuery.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

801 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