Instead of: > $row = mysql_fetch_array($sql) Use: $row = mysql_fetch_assoc($sql) Humberto Silva World Editing Portugal -----Original Message----- From: John W. Holmes [mailto:holmes072000@xxxxxxxxxxx] Sent: sexta-feira, 23 de Janeiro de 2004 15:42 To: lgs@xxxxxxxxxxx; Tristan.Pretty@xxxxxxxxxxxxxxxx Cc: php-db@xxxxxxxxxxxxx Subject: Re: Drop down box NOT populated From: <Tristan.Pretty@xxxxxxxxxxxxxxxx> > Jsut a guess... > Your row has a capital 'A' in the SQL statement, and a lower case 'a' > in teh $row[] call.. > > does that matter? Yep, that would matter, but not the exact problem. I don't know if this thread has already been answered or not, so... The real problem is with this: > $sql = mysql_query("SELECT distinct(Account) FROM Backlog")or die > ("Something bad happened here: " . mysql_error()) ; > > echo "<select name=\"account\">\n"; > echo "<option>\n"; > > while ($row = mysql_fetch_array($sql)) > { > echo ' <option > value="'.$row["account"].'">'.$row["account"]."</option>\n"; because there is no "account" index in $row. You're not selecting "account", you're selecting "distinct(Account)". So, you could do it the hard way and use $row['distinct(Account)'] as your value or change your SQL to: $sql = mysql_query("SELECT distinct(Account) AS acc FROM Backlog")or die and use $row['acc']. This is called making an alias. You alias the distinct(account) column to be called "acc". You can name the alias what ever you want. If you developed with your error_reporting() set to E_ALL, you'd have gotten a notice about "Undefined index 'account' in $row" that may have tipped you off to all of this. Hope this helps. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php