Jump to content

soccerstar_23

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by soccerstar_23

  1. Hello,

    I'm creating a photo gallery and for individual photos, you may "tag" one.  For example, when someone makes a stupid face in the photo, you may give the photo the "Funny" tag.  Each photo may have multiple tags (e.g. "Funny", "Stupid", "Idiot"). 

    To let users add a tag to a photo, I give them a "<SELECT>" box to choose from a list of existing tags.  Obviously, if the photo already has the "Stupid" tag, I do not want tag showing up in the dropdown list.

    I'm having problems coming up with a good MySQL statement to get the information.  The tables are as follows:

    MEDIA
    --------------
    media_id
    media_title
    ......

    MEDIA TAG
    --------------
    media_id
    tag_id
    user_id

    USERS
    --------------
    user_id
    user_handle
    ....

    Seeing as tags can be used on multiple photos, the JOIN seems to be pretty complicated.

    I've tried a variation of the following with incorrect results:

    SELECT * FROM dg_tags t
    LEFT JOIN (dg_media_tags mt)
    ON (t.tag_id = mt.tag_id AND mt.media_id != 6)
    ORDER BY t.tag_title

    What can I do to get the select box of "tags" that arent' in use for a specific photo?

    Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.