extrovertive Posted October 17, 2006 Share Posted October 17, 2006 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 myWould the form be like this?[code]Tags, seperated by comma <input type="text" name="tags" />[/code]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)? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted October 17, 2006 Share Posted October 17, 2006 Have a table called tags with a structure like this:tag_idtag_object_idtag_user_idtag_name Quote Link to comment Share on other sites More sharing options...
extrovertive Posted October 17, 2006 Author Share Posted October 17, 2006 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? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted October 17, 2006 Share Posted October 17, 2006 Yeah Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.