SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Find related post in mysql

    Hi All,
    I have data table which contains fields "id, title, post_data,tag(comma separated)" and tag_name table which contains id,tag.

    Now I need to find most relevant topic for a particular post by using the tag, Which is having more similar tags.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,135
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Why are the posts tags in a comma separated list as opposed to a separate table that relates a tag to a post?
    The only code I hate more than my own is everyone else's.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because I want to display cloud tag like in wordpress... For that I need the tag name and number of post mentioning the tag.

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,491
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Normalize your database by eliminating the column with comma separated values, and create a new table (posttags) instead (like oddz says). That new table will contain a row for each post-tag couple.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •