?
Solved

Populating a drop down (combo box)

Posted on 2005-02-24
2
Medium Priority
?
2,215 Views
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
0
Comment
Question by:ShaneJones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 33

Accepted Solution

by:
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)) {
    extract($row);
    echo "<option >$lName</option>\n";
}
mysql_free_result($result);
?>
0
 
LVL 33

Expert Comment

by:sajuks
ID: 13391360
Thanks for the points and grade
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

762 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