Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    category/subcategory results

    I am trying to attach categories and multiple subcategories to a library database... you choose a category or sub-category from dropdowns and you get results for each product.

    The product could have multiple sub-categories or keywords.

    A sub-category could fall under more than one category.

    I don't know the database component where I would assign sub-categories to a particular item so that it could be found.

    So....choose an item in a category dropdown and you get results.
    When you choose a category, a second dropdown produces some sub-options. Choose a subcat and you get results. But a product could be associated have anywhere from 1 to 10 subcategories

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,757
    Thanks
    23
    Thanked 546 Times in 545 Posts
    Yes! Sounds good.
    Evolution - The non-random survival of random variants.

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,899
    Thanks
    15
    Thanked 226 Times in 226 Posts
    You can put multiple instances in one database category by using an additional separator, such as '|' in addition to the usual ',' then you can explode that category with php or split it with javascript to build your select box. This is well suited to what you want to do.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #4
    New Coder
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am unfamiliar with this. I had help in creating a couple of tables...one being a category table, one being a subcat table, and being a keyword table. But I have not been able to finish and am unfamiliar with the code that my help gave me.

    I really need help with the database setup, understanding the code, and being able to draw results.

    Right now I have:
    1. Dropdowns with categories.
    2. Potentially a secondary dropdown with sub-cats that are revealed depending on the category. The sub-category can also include all the results of the category.

    Depending on what is chosen, I need to produce results. The criteria are:
    1. Each drill is identified by a category (could have more than one actually).
    2. Each drill has 1 or more subcategories
    3. A sub-category can exist in more than category.

    So for example I am doing a basketball library database. I could choose Defense and then choose the Subcategory of Help Defense and that should bring up the drills that have that keyword or subcat.

    My original database structure had multiple keywords in a keyword field separated by either a comma or space. i really could not use a keyword open field search because if i put in post dense.. i would get all the drills with the keyword defense and all with post.. more than what i needed.

    So i really need help now being knowing how to assign more than one keyword or subcat to a database entry and be able to bring up all results that have that category and\or sub-cat.

  • #5
    New Coder
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anyone help? I am stuck.

  • #6
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,757
    Thanks
    23
    Thanked 546 Times in 545 Posts
    @freedom123, you've been here long enough to know you need to post your code to get an answer.

    "Populating drop down list based on value from another drop down" has been answered on this forum a bunch of times. Use the search function here and look for it or read this http://javascript.about.com/library/bldydrop1.htm

    You can use a database or you can use arrays to get the info for the 2nd DD. Since you don't know how to set up a DB and that would also mean using ajax, I'd stick with arrays and javascript, not php. Give it a go and if you need more help remember to post the code your having problems with.
    Evolution - The non-random survival of random variants.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •