recursive query

    Date: 03/23/06 (MySQL Communtiy)    Keywords: php, database, sql

    wondering if anyone could help me, i'm trying to help a friend quickly on a project, and i'm terrible at recursive functions

    i have a table of 'genres' for music club 'venues' - each genre can have a 'parentID' if it is a sub-genre of another genre

    really roughly he has something like this -

    genre
    -----
    [genreID]
    name
    parentID

    venue
    -----
    [venueID]
    name

    venure_genre
    ------------
    [venueID
    genreID]

    I'm trying to help him build a form to submit venues into a database and assign them 1 or more genres -

    i'd like to have the genre selection be a multiple select box, with subgenres spaced over with  's i.e.



    I don't really need any help with the output as much as the query - I could do this the long way, and query all the top level genres, store them, then query each top level's sub genre's, etc etc, but i was wondering if anyone with experience writing recursive SQL querys/PHP functions could lend a hand

    thanks

    cross-posted to '[info]'php

    Source: http://community.livejournal.com/mysql/90644.html

« The sum total of a column || Query Question »


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