I'm trying to format the results of two sets to appear in similar tables. One is a MySQL query and has a ldap query. The only problem is a result with a foreach loop displayed, counting through other results, and I'm not sure how to do one thing with each other.
/ * This is mysql query I am pulling information and creating a table * with the result # $ is the column of header array table. After this, as a result of a foreign result, I removed the result of my query * in the same order as my column. * / $ Result = db_query ("Select from where table" '. $ SearchParams. "` =' ". $ Input." '"); $ Header = array (T (' first name '), T (' Last name '), T (' passport number '), T (' visa type '), T (' step in process')); $ rows = array (); foreign currency ($ result as $ result) { $ Rows [] = array ($ result-> first_name, $ result -> gt; last_name, $ result -> gtv, $ result -> visas_type, $ result -> current_stage,);} Return Theme ('Table', Array ('Header' = & Gt; $ header, 'rows' = & gt; $ rows)) / * Here I am currently displaying my ldap_search () results * / $ ds = ldap_connect ("ldap-server" ); $ Info = ldap_get_entries ($ ds); $ ($ ds) $ $ l = ldap_bind ($ ds); $ Sr = ldap_search ($ DS, "DC =, DC = co, DC = UK" $ Sr) ($ i = 0; $ i & lt; $ info ["count"]; $ i ++) {echo "DN:" $ info [$ i] ["DN"] "& Lt ; Br / & gt; "echo" is the first CN entry: "$ info [$ i] [" cn "] [0]" & lt; Br /> "echo" is the first email entry: ". $ Info [$ i] [" mail "] [0]" & lt; Br / & gt; & Lt; Hour / & gt; ";}
How do I change LAPEpe results so that I can create a table with mysql result which I can use with the same foreach? That's very easy, I still try to wrap my head around loop, count and things around.
To add to my comment:
You can do this within
foreach
, just add an index, exampleforeach ( $ Index = = result as a result)
For example
foreach ($ index as $ index = & gt; ; $ Result) {if (isset ($ info [$ index])) {// $ both results and $ info}}
Comments
Post a Comment