I'm submitting tags into a DB like tag1,tag2,tag3. How would I go about splitting them so i could pharse them into links and then query the DB for other submissions that use those tags?
3
votes
3 Answers
4
votes
1
votes
0
votes
A very simple but very hackey approach would be to enter your tags with beginning and trailing commas so ,tag1,tag2,tag3,tag4, because then you can get tag2 by querying for where tag LIKE '%,tag2,%' Granted this is slow and there are way more advanced ways to do this via 1:many relationships. If you want to make tags into links I would look into a structure where 1 table has posts and one table has tags. http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html has a few table structures and explanations on how this works.