|
Posted by IchBin on 11/24/05 18:15
Harry wrote:
> Hi!
>
> What kind of var should I use to store some words in a field?
>
> For instance, I would like to save some key words for each user. How can
> I achieve it?
>
> USER KEY WORDS
> john family,sports,basket,pete
> lucas mirror,dog,soccer
>
> I can't use SET var because the words can be different, defined by the
> user.
>
> I have thought of using some fields such as KEYWORD1 KEYWORD2 KEYWORD3,
> and store a string, but I don't want to limit the user.
>
> Regards!
Just create a separate table just for Keywords. Table would have these
rows..
- keyword_id, auto_increment
- user_foreign_key(FK), from the PK of your user table
- keyword
Have the primary key as keyword_id,user_foreign_key,keyword.
Also you can now add a constraint on this new keyword table to delete
all of the keywords/user when a user_id(PK) is deleted from your user
table. Example ..
CONSTRAINT cascadeDelete FOREIGN KEY( user_foreign_key ) REFERENCES
user_table( user_id ) ON DELETE CASCADE
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Navigation:
[Reply to this message]
|