building a categorie system

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dsick
Forum Commoner
Posts: 57
Joined: Fri Mar 27, 2009 3:34 pm

building a categorie system

Post by dsick »

[moved by moderator to PHP - Code forum]
ok, this will have a option drop down menu, with all the categories a user can upload to, could i use if isset to test if a option is selected, then when it is i am going to write to that table the user selected, i will put the write query after the if statement and i will put the if statement after the drop down menu, but my only problem is i would have to do the if statement for each category and if i have more than 30 categories my coding can get messy, im looking for something i can use that will test if a category is selected without having to test every category
i will also have to switch the type of the categories so i can wrap them in a if isset test. unless i can put plain text into an if statement. i think im going about this the wrong way as i shouldn't test if the category is selected, i should test if the option number is selected because my categories might change.
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: building a categorie system

Post by mattpointblank »

Are you saying you're putting rows into a different table depending on what category the item is in? Why not simplify your database and just store the category ID in a single table? Then no need for lots of switches, just use the ID value.
Post Reply