Display information in dropdown list from database query PHP/HTML
I'm having trouble with a bit of code I wrote, I can't seem to find any problems with it and its driving me crazy
// create connection
$conn=odbc_connect('SkyeGaccess1','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql = "SELECT Username FROM Customers";
$rs = mysql_query($sql);
echo "<select name='Username'>";
while ($row = mysql_fetch_array($rs)) {
echo "<option value='" . $row['Username'] ."'>" . $row['Username'] ."</option>";
}
echo "</select>";
odbc_close($conn);
?>
I've looked around everywhere and this seems to be exactly how I'm supposed to write this piece of code. Its not a problem with the database connection as I can put the information into a table just fine, but I just can't get it to show up on the dropdown list.
Answer
Solution:
Replace with this code. This will help!
Ping here on any issues!