I've been trying to populate a dropdown list with results from a query using php from a mysql table but the list is empty. Could someone please take a look at my code and tell me what it is that I'm doing wrong.
My query is Select cat from kernel
I used the code : $results = $query->fetchAll();
Heres my code:
<?php
$dbhandle = new PDO('host','username','password');
$sql = "SELECT cat FROM kernel";
$results = $query->fetchAll();
echo "<select name='cat'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['cat'] . "'>" . $row['cat'] . "</option>";
}
echo "</select>";
?>