I just need to use php to find all cities in a MySQL database and return the results in a drop down box. Can somebody suggest some code? The table name is tblLodges and the field name is strLodgeMailingCity....

Query:

"SELECT tblLodgesMailingCity FROM tblLodges WHERE tblLodgesMaililngCity<>NULL"

Then, within a while loop, spit out the code:

<select id="ddl">
<?php
//query...

while
{
echo "<option value=\"$city\">$city</option>";
}
?>
</select>

vualla.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.