IT SOLUTIONS
Your TECHNOLOGY partner! 
-Collapse +Expand
PHP
Search PHP Group:

Advanced
-Collapse +Expand PHP Group Home
-Collapse +Expand Message Board
-Collapse +Expand PHP KB
-Collapse +Expand PHP Store
PRESTWOODSTORE
-Collapse +Expand Members Only

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPHP & Delphi for PHP BoardPHP Topic     Print This   

dropdownbox that is populated from a mysql db?

dropdownbox that is populated from a mysql db? in PHP topic (part of our PHP & Delphi for PHP group).

Quick Search: dropdownbox   populated   dropdownbox that   dropdownbox that populated   mysql db  
Most Recent Post

S 0 n Y

Hello everyone, I am wanting to create a dropdown list box that is populated from a mysql database, currently I have figured how to query out what information I need from my database but I do not know how to get it to display correctly in the drop down box. Can someone give me some pointers or help? Down below is a sample code I have created which queries my database and shows the information I queried on the screen, can anyone give me some pointers or lead me in the right direction on making the listbox have the values? After I get that far, I may have other questions, because once someone clicks on one of the values from the dropdown list, I would like to run a query on the value selected and show values on the screen based on what is clicked.. Thank you guys for your time.

Example:

?>

$user="mysqluser";
$pass="****";
$db="test";

$link = @mysql_connect ( "localhost", $user, $pass );

if ( ! $link ) {
 die ( "Couldn't Connect to Preferred Breeders Database. Try Again".mysql_error());
}

@mysql_select_db($db)
 or die ( "Couldn't open $db: ".mysql_error() );

$result=mysql_query("SELECT DISTINCT NAME FROM test.states WHERE (STATE = 'MS')");

$num_rows=mysql_num_rows($result);

 while ($a_row=mysql_fetch_row($result)){

 print "\n";
 foreach ($a_row as $field){
  print "$field
";
 }
 print "\n";
}

mysql_close($link);

?>

 Posted 46 months ago (Thread Starter)
Comment Quote
Location=Baton Rouge, LA USA,  Joined=6 years ago   MB Posts=53  
More... -Collapse +Expand
S 0 n Y
Baton Rouge, LA USA
Rank: Ensign
Email A E LA USA
Approved member.
Member does not subscribe to this thread.

Post ID #13578, No Replies Be the first!
Thread Started 7/1/2009 12:24:18 PM
View Counter=1637

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P191A
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #13578 Counter
1637
Since 7/1/2009
-
  Load Time=less than 1 second.
 
Print This
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


1,769 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join now. It's free!
Show More...


©1995-2013 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech