Current location: Hot Scripts Forums » Programming Languages » PHP » Populating a dropdown using data from mysql table

Populating a dropdown using data from mysql table

 
Prev Previous Post   Next Post Next
  #1  
Old 06-05-09, 03:31 PM
DimensionX DimensionX is offline
Newbie Coder
 
Join Date: May 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Populating a dropdown using data from mysql table

Hi,

I'm trying to make a dropdown box pull it's contents from a table called client but the page isn't loading it just goes blank and without the dropdown it loads fine so I've obviously messed this up, it connects to the database ok but just doesn't like what i did with the drop down.

PHP Code:
<td>Referred by:</td><td><select name="referredBy" tabindex="11">
            <option value="">Please select a client or the value None</option>
            <option value="None">None</option>
            
            <?php
            
//Assign the query
            
$query "SELECT * FROM client ORDER BY clientId ASC";

            
//Execute the query
            
$result mysql_query$query );
            if(!
$result){
                die (
"Could not query the database: <br />"mysql_error());
            }
            
            while (
$result_row mysql_fetch_array($resultMYSQL_ASSOC)){
            {
                echo 
'<option value="' $result_row["clientId"] . '">'$result_row["clientId"] . ' ' .                   $result_row["firstName"] . ' ' $result_row["surName"]  . '</option>';
            }
            
            
?>
            </select></td>
any help would be greatly appreciated, I'm still really new at php so I'm sorry if my code isn't clearly laid out.

thanks
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help extracting data from html and writing it to mysql? method PHP 2 06-12-08 12:53 PM
Moving data to another mySQL table zoliky Database 3 10-04-06 06:53 PM
populating a dropdown list (mysql) HeX Productions Script Requests 2 09-30-06 05:57 AM
Inserting data to mysql table using php Tjobbe PHP 4 09-28-06 07:37 AM


All times are GMT -5. The time now is 04:54 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)