Jump to content

samuvk

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by samuvk

  1. 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>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.