sql >> Database teknologi >  >> RDS >> Mysql

Udfyld rullemenuen Vælg fra en databasetabel

$query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort";

$res = mysql_query($query);
echo "<select name = 'venue'>";
while (($row = mysql_fetch_row($res)) != null)
{
    echo "<option value = '{$row['venue_id']}'";
    if ($selected_venue_id == $row['venue_id'])
        echo "selected = 'selected'";
    echo ">{$row['venue_name']}</option>";
}
echo "</select>";


  1. Er der en MySQL-kommando til at implementere noget som drop-tabeller undtagen t1,b2?

  2. Få det sidste indsatte auto-increment-id i mysql

  3. Er det dårligt design at bruge arrays i en database?

  4. lavaral 5 FEJL{ (SQLSTATE[HY000] [1045] Adgang nægtet for brugeren 'root'@'localhost' (ved hjælp af adgangskode:JA)}