Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2004, 07:50 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default mysql table fields in combo box

how can i get mysql fields in combo box i write the following codes
but i could not be sucessfull any help

=========================
<?php while($query_data=mysql_fetch_array($result)
{
echo "<option value=$query_data[event_name]</option>";
}?>
</select>
i also used mysql_fetch_row and object methods

pls help me



 
Old March 10th, 2004, 01:09 PM
Registered User
 
Join Date: Jul 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is no problem.:)

see this example
    $sqlYearList = "SELECT * FROM vehicle_year";
    db_connect($default_dbname);
    $resultYearList = mysql_query($sqlYearList);
    while ($rowYearList = mysql_fetch_array( $resultYearList )){
        $selectYearList = $selectYearList . "<OPTION VALUE='$rowYearList[0]'>$rowYearList[1]</OPTION><br>";
    }
    echo $selectYearList;

// Thae vehicle_year table have 1st 2 fields year_code and year respectively.

Happy programming.

Musharaf ;)

Musharaf Choudhry
 
Old March 12th, 2004, 12:40 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

Thanks musharaf thanks alot

 
Old March 17th, 2004, 09:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your problem was that you were missing the closing paren in your while() conditional expression.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a text box from a combo box value dnf999 Access VBA 7 February 6th, 2012 02:24 PM
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.