[tagging system | mysql statements] search for multiple tags

    Date: 02/13/09 (PHP Community)    Keywords: no keywords

    Hello,

    I've hit a snag with my tagging system. I can find items tagged with tag x, but I can't find items tagged with tag x and tag y.

    My tagging system is set up like this: entries, tags, entry_tags. The entry_tags joins tags with the specified entry.

    In this way, each tag has its own row... so it's tag 1 to entry 1 is separate to tag 2 to entry 1 (as opposed to tag 1 and tag 2 to entry 1).

    What I'm trying to do is select an entry with two or more tags attached to it. So, I guess I'm looking for something like:

    tag 1 to entry 1
    tag 2 to entry 1
    tag 1 to entry 2

    ... and selecting entry 1 when searching for tag 1 and tag 2. Not entry 2.

    Unfortunately, I can't seem to find an appropriate string for it. I've tried using FIND_IN_SET() and IN() but they're displaying all entries with any of the tags submitted, and not ... all of them. I've also tried using lots of ANDs but that doesn't work either.

    I'm not sure what else to try? I thought this would have been rather straightforward. :P

    Thanks for any help. :)

    Source: http://community.livejournal.com/php/657532.html

« php driven image gallery -... || Working with multi arrays »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home