I would like to fill a combobox from my data in a table of my postgresql database. Here is my code: but I'm getting the combobox empty.
<html>
<body>
<select>
<?php
$db = pg_connect('host=localhost dbname=test user=myusername password=mypassword') or die ("Could not connect to DB");
$sql = pg_query(sprintf("SELECT City FROM Cities"));
while ($row = pg_fetch_assoc($sql))
{
echo "<option value=$row[City]>$row[City]</option>";
}
pg_close($db);
?>
</select>
</body>
</html>