Welcome, Guest. Please Login or Register.
October 08, 2024, 05:31:19 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Populate a Combobox with Sql data? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Populate a Combobox with Sql data?  (Read 1456 times)
Ayeka
Jr. Member
**
Posts: 80


Good & Evil, there is never one without the other.

WWW
Populate a Combobox with Sql data?
« on: November 07, 2003, 09:12:21 PM »
Reply with quote

Is there a way to populate the combobox control with data from my SQL server, instead of trying to hard code <option>'s?

Thank you.
Logged

--Ayeka
Master of the purple!
HAHAhahahahahaha!
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:Populate a Combobox with Sql data?
« Reply #1 on: November 07, 2003, 10:56:38 PM »
Reply with quote

of course, its just like retreiving data from database into html
just print the options on loop
example:
echo '<select name="people">';
$request = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_assoc($request))
{
   echo '<option value="' . $member['member_id'] . '">' . $member['name'] . '</option>';
}
echo '</select>';
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Populate a Combobox with Sql data? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.097 seconds with 21 queries.