Jump to content


Photo

Creating a tagging system search database?


  • Please log in to reply
3 replies to this topic

#1 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 17 October 2006 - 08:22 AM

Sites with a 'tagged' feature which you can add tags to your blog item, bookmark item, news item, etc, how are these tags stored in the database?


Say, if I have a profile page and I want to tags my

Would the form be like this?

Tags, seperated by comma <input type="text" name="tags" />

Then in my PHP code for storing the tags in the database for searching, are the tags stored all in one field or seperate rows for each tag?

How would the query work to search for certain items (news, blogs, etc) based on tag(s)?



#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 17 October 2006 - 09:07 AM

Have a table called tags with a structure like this:

tag_id
tag_object_id
tag_user_id
tag_name

#3 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 17 October 2006 - 09:28 AM

So, each tag has an id of its own?

Let's say a user has a blog, and enter tags. If a tag_name already exist in the database, then don't add it right, but if it doesn't exists then auto increment the tag_id and add the tag_name?

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 17 October 2006 - 01:35 PM

Yeah




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users