Jump to content

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/397-i-know-someone-can-help-me-with-this/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.