I need to generate a drop down menu from data in a MySQL table.
From the table, it'll have to take the user id and the username.
Then it'll set the user id to option value and the username to what shows up in the drop down.
Could anyone show me some code for it? I'm having trouble making the following work:
$sql = "SELECT user_id, user_name FROM users";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo "<option value=\".$row['user_id'].\">.$row['user_name'].</option>
";
echo "<option value=\"12275\">".$row['user_name']."</option>
";
}