Populating a drop down (combo box)

Posted on 2005-02-24
Medium Priority
Last Modified: 2013-12-13
I have this SQL

SELECT lName FROM Locations;

how can i get the results of this code to populate a drop down combo box.

I know how do do the connecting to database it is just the population code i am stuck with,

Many thanks
Question by:ShaneJones
  • 2
LVL 33

Accepted Solution

sajuks earned 200 total points
ID: 13390559
//try this for a mysql db
$query  = "select SELECT lName FROM Locations";

$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
    echo "<option >$lName</option>\n";
LVL 33

Expert Comment

ID: 13391360
Thanks for the points and grade

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question