PHP Mysql, Dropdown Question.

Discussion in 'PHP' started by KingW, Sep 18, 2009.

  1. #1
    Hello, I need some help here

    Ok, I have a Mysql Table like this

    Name | Season | Episode
    Bleach 1 001
    Bleach 1 002
    Bleach 2 030
    Bleach 2 031
    Bleach 3 060
    Bleach 3 061

    Now, What I want it to do is Pull the Name and Season and make a Drop down like this

    Choose a Season \/
    Bleach - Season 1
    Bleach - Season 2
    Bleach - Season 3

    And when One of them is clicked, It pulls all the Episodes from that Anime in that Season, This part I can do, Its just the before I really need help with
     
    KingW, Sep 18, 2009 IP
  2. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    #2
    I couldn't get what you need.

    inside the While Loop you need to put the select code (<select value="xyz">Name - Season No</option>)
     
    Oli3L, Sep 18, 2009 IP
  3. johny321

    johny321 Member

    Messages:
    293
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    you can also use "distinct" keyword in your sql query
     
    johny321, Sep 18, 2009 IP
  4. unitechy

    unitechy Peon

    Messages:
    350
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    $sql = "Select name,season From table";
    $result = mysql_query($sql);
    
    echo"<select name = Animi value=">
    
    While($data=mqsql_fetch_array($result)){
    echo "<option value = $data[name] - $data[season]</option>";
    }
    
    echo "</select>";
    PHP:
    Not sure if this is what you want. But it takes name and season from your database table and displays it in dropdown menu to select from.
     
    unitechy, Sep 19, 2009 IP