I am currently having trouble displaying the entries in a column of my database in a drop down list.
The code below... is half working i guess... When I run it, the
{
is not needed inside <option>
echo "<option>".$row['teamname']."</option>"
<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');
$stmt->execute();
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo '<option>'.$row['teamname'].'</option>';
}
?>
</select>