IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
PHP
Search PHP Group:

Advanced
-Collapse +Expand PHP Store
PRESTWOODSTORE

Prestwood eMagazine

July 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
S0nY
Baton Rouge, LA USA

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 11 years ago (Thread Starter)
Comment Quote
About S0nY -Collapse +Expand
Visit Profile
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=4121
Last Reply Posted 12/29/2015 12:54:47 AM)
Location=Baton Rouge, LA USA 
Joined=13 years ago   MB Posts=53  

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 (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P162A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #13578 Counter
4121
Since 7/1/2009
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2020 Prestwood IT Solutions.   [Security & Privacy]