PHP tag cloud ( and finding similar ones )
Posted
by mfolnovich
on Stack Overflow
See other posts from Stack Overflow
or by mfolnovich
Published on 2010-04-08T19:50:51Z
Indexed on
2010/04/08
19:53 UTC
Read the original article
Hit count: 269
Hello!
I have articles on my site, and I would like to add tags which would describe each article, but I'm having problems with design mysql table for tags. I have two ideas:
1) each article would have field "tags", and tags would be in format: "tag1,tag2,tag3"
2) create other table called tags with fields: tag_name, article_id, so when I want tags for article with ID 1, I would run SELECT ... FROM tags WHERE news_id
=1;
But, I would also like to know 3 similar articles by comparing tags, so if I have article which has tags "php,mysql,erlang", and 5 articles with tags: "php,mysql", "erlang,ruby", "php erlang", "mysql,erlang,javascript", I would choose 1., 3. and 4., since those 3 have most same tags with main article.
Thanks!
© Stack Overflow or respective owner