PHP MYSQL下拉列数据列表

I'm trying to make a drop down list with the data of one of my columns...i'm wandering if the code below is doing that... (it doesn't work by the way) Thanks very much!

<select id="teamlist" name="teamlist">
<?php
        $pdo = new PDO('mysql:host=localhost;dbname=clubresults', 'root', '12345678');
    #Set Error Mode to ERRMODE_EXCEPTION.
    $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  



$stmt = $pdo->prepare('Select teamname from members');

   while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
     echo "<option>$row</option>";
   }
 ?>
</select> 

You must execute your statement first before you can fetch results.

$stmt->execute();

or you can use query

$pdo->query('select ... ');

You can read more here and here

Referring this link

You must execute the prepare statement as follows.

$sql = 'SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();

your pdoStatement::fetch returns an associative array, you need to select the correct value in your array, not just give the array itself to print, which as you noticed prints as nothing.

echo "<option>{$row['teamname']}</option>";

is what you need