Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / December 2005



Tip: Looking for answers? Try searching our database.

Selecting multiple cats with one field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Slammy - 31 Dec 2005 01:09 GMT
:confused;

Here is my situation; I have a public poem database where visitors can post
and read  poems. These poems are listed under different categories. The
categories and poems reside in separate tables and the table is set so its one
poem under each category.  
I am working on a members only area where a member can have an unlimited
amount of poems under their account and have each poem listed under the main
category. So there will be at least two categories in which their poem shows,
the public and the member. What I would like to have the category field in the
poem table hold the cat_id?s for both the member only and private categories. I
would like to keep this is in one field so some poems can be shown in extra
categories later. This looks like a many to many relationship problem.  I have
several questions on the mechanics of this.
1. How should I store such list in the database field? I tried a set data type
but that didn?t work well.
2. How do I write a query which will find the correct cat_id in the list? I
tried an in() but that pulled out everything with the specific number. All 1's,
all 2's etc.
3. What will be the best way to append, or delete the categories in this
field.

Any help or references would be appreciated.

Thanks Happy New Year,

Slate
Dan Bracuk - 31 Dec 2005 03:01 GMT
I suggest that you keep the one to many relationship between categories and
poems.  Your idea of a main category sounds like it will give members access to
each other's poems, which might not be what you want.  Depending on your plan,
you might want to set up some sort of relationship between poems and members.  

With regards to your question number 1, How should you store lists in your
database?  You shouldn't.  Many to many relationships use separate tables not
lists.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.