[PHP] drop down list not populating
Hi I've got the code for a drop down list and the drop down box displays--but with no info in it. The underlying table is populated so I could use some advice on what might be wrong from here SELECT ? include(includes/db.php); MYSQL_CONNECT(HOST,USER,PASS) OR DIE(Unable to connect to database); @mysql_select_db(DB) or die( Unable to select database); $query=(select * from community order by community); $result=mysql_query($query) or die (Unable to Make the Query: . mysql_error() ); while($row=mysql_fetch_array($result)){ echo OPTION VALUE=.$row['community']./OPTION; } ? /SELECT Any ideas? Thanks Dan
Re: [PHP] drop down list not populating
Hello Dan, On 27 Jan 2004 at 14:31, Montagna, Dan wrote: echo OPTION VALUE=.$row['community']./OPTION; Uh-oh, this won't work: you have an unclosed tag here. Try this: echo 'option value='.$row['community'].''.$row['community'].'/option'; Good luck, Erik
Re: [PHP] drop down list not populating
Montagna, Dan wrote: I've got the code for a drop down list and the drop down box displays--but with no info in it. The underlying table is populated so I could use some advice on what might be wrong from here SELECT ? include(includes/db.php); MYSQL_CONNECT(HOST,USER,PASS) OR DIE(Unable to connect to database); @mysql_select_db(DB) or die( Unable to select database); $query=(select * from community order by community); $result=mysql_query($query) or die (Unable to Make the Query: . mysql_error() ); while($row=mysql_fetch_array($result)){ Try a print_r($row) here to see what's being retrieved from the result set. echo OPTION VALUE=.$row['community']./OPTION; } ? /SELECT Any ideas? If you view the HTML source of the page, do you see a bunch of empty option elements? If so, then $row['community'] isn't valid. Maybe it's a case issue and you should be using $row['Community']? Can't tell because you're using SELECT *, though... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] drop down list not populating
John W. Holmes wrote: snip echo OPTION VALUE=.$row['community']./OPTION; If you view the HTML source of the page, do you see a bunch of empty option elements? If so, then $row['community'] isn't valid. Maybe it's a case issue and you should be using $row['Community']? Can't tell because you're using SELECT *, though... And he has an open HTML tag. There's no closing bracket for the option. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php