a51hh Posted November 6, 2006 Share Posted November 6, 2006 table1ID Category SubCategory1 100 1000102 100 1000103 100 1000104 100 1000205 100 1000206 100 1000207 100 1000208 100 1000309 100 100040table2ID Email First Last Address info1 some@email.com John Smith infohere2 another@email.com Luis Smith infohereurl.com/searchresults.php?category=100&subcategory=100010I need to be able to pull and display according to categories and subcategories using $_GET as displayed above.1st query runs and pulls all of the ID's according to Category and SubCategory.The resulting IDs need to be displayed in rows using HTML formating and possibly have code to run over multiple pages.I need to display the results from table 2 after I filter what categories from the $_GET method.If someone can give me some code examples I would be greatful. Quote Link to comment Share on other sites More sharing options...
pnj Posted November 6, 2006 Share Posted November 6, 2006 you want to run a query something like this:SELECT * FROM table1 INNER JOIN table2 ON table1.ID=table2.ID ORDER BY Category, SubCategory;That will get you a flat table with one row for each person, ordered by category and subcategory. Then walk through that table, saving the current category or subcategory. If it is different from the last, print the heading.-pnj Quote Link to comment Share on other sites More sharing options...
fenway Posted November 6, 2006 Share Posted November 6, 2006 That's about right.. you'll need a "seen" hash to keep track. Quote Link to comment Share on other sites More sharing options...
a51hh Posted November 6, 2006 Author Share Posted November 6, 2006 Thanks guys for the reply. It works like a charm. Glad I have something to fall back on. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.