Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   PHP ldap and mysql results merge (http://www.go4expert.com/forums/php-ldap-mysql-results-merge-t18580/)

gilbertsavier 17Jul2009 12:08

PHP ldap and mysql results merge
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-de...lts-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.

pradeep 10Aug2009 11:06

Re: PHP ldap and mysql results merge
Yes, please post some snippets!

All times are GMT +5.5. The time now is 17:24.