: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.