JustinSmall
02-06-2008, 12:53 AM
Ok, I want to flood a drop down box from a MySQL database.
I'm kinda thinking I would be using a while command, but I don't see how I would do it.
Does anyone have any ideas?
Dan L
02-06-2008, 02:23 AM
<select name="userid">
<?php
$query = mysql_query('SELECT `id`,`username` FROM `users` ORDER BY `username` ASC;');
while($rs = mysql_fetch_assoc($query)) {
echo '<option value="'.$rs['id'].'">'.$rs['username'].'</option>';
}
?>
</select>
There you have it.
JustinSmall
02-06-2008, 10:18 AM
Excellent, see the value was going to be worrying me! But now that perfectly makes sense.
Damn, I feel dumb now.
Codebird
02-06-2008, 03:49 PM
Just a little question, why did u use the word flood?
JustinSmall
02-06-2008, 04:15 PM
This is going on my Admin Control Panel for my clients site. Because it drops mass information... like a flood is "mass water" ... I dunno it's not for negative use.
It actually makes a drop down thats filled (I should have probably used the word fills instead of flood) with a list of categories that they can select.
Codebird
02-06-2008, 04:19 PM
hehehe ok thanks no I was just wondering cause when I read the question I didn't know what u mean, it is till I read the answer that I understood