Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP/Mysql Help

Options
  • 27-02-2007 2:11am
    #1
    Closed Accounts Posts: 44


    Hi

    This is probably a really easy thing to achieve but iv been trying for a while now and i cant find an answer that i can understand. I've tried googling it but havent come across a solution i can use

    Looking to fill a drop down box with data from a database

    Basically i have a "charity" table and looking to populate a drop down box with a list of "charity_names"

    Thanks
    Daryll


Comments

  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Something along those lines!
    $sql = "SELECT id,charity_name FROM charity_table ORDER BY charity_name ASC";
    $data = mysql_query($sql);
    while ($row = mysql_fetch_assoc($data)) 
    {
       	echo'
    		<option value="'.$row['id'].'">'.$row['charity_name'].'</option>
    	';		
    }
    


  • Closed Accounts Posts: 44 daryllsheridan


    Cheers

    That works fine!


Advertisement