1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP ldap and mysql results merge

Discussion in 'PHP' started by gilbertsavier, Jul 17, 2009.

  1. gilbertsavier

    gilbertsavier New Member

    Jun 25, 2009
    Likes Received:
    Trophy Points:
    I am currently trying to write a quick page for use with our phones, to centralise phonebook results.
    ????: EduGeek.net Forums http://www.edugeek.net/forums/web-development/26654-php-ldap-mysql-results-merge.html

    I have all the staff phone extensions, and email addresses in one place - our active directory. This is kept up to date, as it is a nice place to do so.

    I also have the freepbx 'users' table, which contains a list of all the phone extensions on the system. This includes all the phone numbers from the active directory, but not email addresses. It also has extra extensions such as 'Year 5 block' etc...

    So neither list contains everything.

    Now, rather than having to create Active Directory objects for the non-people extensions, is there a way I can merge the results from a php ldap_search and a mysql_query?

    I made the initial mistake of iterating through each line of the ldap array and if they matched, output one thing, if they didn't then output another. But this meant that every single row contained every single record from the mysql array...

    I can think of one way of dealing with it, this being a third array which I add the index values to when a match is made, which is checked by the above loops, and if that row has already been output then it isn't output again, but this seems very messy.

    So any ideas? I can post snippets of code if that will help.
  2. pradeep

    pradeep Team Leader

    Apr 4, 2005
    Likes Received:
    Trophy Points:
    Kolkata, India
    Home Page:
    Yes, please post some snippets!

Share This Page