FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

tag system?

 


Mgccl
I was thinking of making tag system so it can replace the category system.
Category system is kind easy to make because you can define the level and what is under that level
but when I thought about the tag system, I can't think of an good answer.
The only one I have thought of is a db structure that can lead the program to find the tag

Code:

item_id *| tag_id *
1           | 1
1           | 2
1           | 3
2           | 2

Note: both ids are keys...
So what does you guys think? is this the perfect way to make tag system or is there better?
AftershockVibe
Thats the way you want to be thinking about it.

You need 3 tables. First, define the tags and the items:

Items(ItemId*, ItemName, etc)
Tags(TagId*,TagName)

Then a link table:

ItemTags(LinkId*, ItemId¬, TagId¬)

* - Primary Key
¬ - Secondary (Foreign) Key
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.