ShoelessJoe Posted April 26, 2003 Share Posted April 26, 2003 BACKGROUND Ive got a list of checkboxes. Each one is a unique keyword. There can be multiple keywords per Subroup but a keyword can only be associated with one subgroup. Subgroup A Keyword A Keyword B Keyword C Subgroup B Keyword D Keyword E Keyword F Subgroup C Keyword G Keyword H Keyword I etc... Each Subgroup is associated with several Groups Group A Subgroup A Subgroup E Group B Subgroup A Subgroup B Group C Subgroup B Subgroup E So, in other words, keyword A would be associated with Group A and Group B via Subgroup A. Keyword E, on the other hand, which is associated with Subgroup B would also be associated with Group B but also associated with Group C A person may select A, B, or A and B (as well as any or all of the keywords but I\'m limiting this example to keep it simple). Therefore their choice. depending upon which keyword(s) selected could be associated with Group A and B, or Group B and C, or A, B, and C. In most, one would select keywords only under a single Subgroup but they are not limited to soing so. Upon selecting keywords and clicking on submit, I want to bring up a page with a list of only those Groups associated with the selected keywords (I need to limit the number of groups because, while there are perhaps 75 keywords and fewer than 10 subgroups, there are thousands of Groups. The Groups will have check boxes and will be in columns. In other words, after all is said and done, someone will have chosen a list of keywords and a list of groups. The subgroup selected are implicit since a keyword can must be associated with a single subgroup. Here are my tables and relevant fields: keywords: k.keywordid, k.name, k.subgroupid group: g.subgroupid, g.name MY MySQL PROBLEM IS THIS: I need to pass the list of all keywords selected on to the second page and then again on to a third. I know I want to select g.name from group from each row where g.subgroupid equals k.subgroupid. Since they will typically select several keywords under a given subgroup, this means that I will be pulling up the same subgroup, and by relationship, group, several times. So I want to eliminate duplicates before printing and then passing on names to the next page. Of course I will be passing both a list of keywords selected and Groups selected along to the next page whereupon additional information will be collected and everthing thereafter stored into the appropriate tables.[/b] Quote Link to comment https://forums.phpfreaks.com/topic/397-i-know-someone-can-help-me-with-this/ Share on other sites More sharing options...
effigy Posted April 29, 2003 Share Posted April 29, 2003 wow. :shock: it\'s 1am... short response: can you use DISTINCT? Quote Link to comment https://forums.phpfreaks.com/topic/397-i-know-someone-can-help-me-with-this/#findComment-1380 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.