hi i am new to php and am trying to create a drop down menu that reads certain fields of all records into a drop down menu to select, there are more than one records in the mySQL table but it is displaying the first record and for all of them, i.e 3 records 3 records in drop down but all the first record, think it is a simple problem with my loop, here is the code, thanks in advance for any help
//build and issue query
$sql = "SELECT userID, f_name, l_name, user_name, password
FROM $table_name ORDER BY l_name";
$result = @($sql,$connection) or die(mysql_error());
//check the number of results
$num = @mysql_num_rows($result);
if ($num < 1) {
//if there are no results,display message
$msg = "<P><em>Sorry!No results.</em></p>";
} else {
//if results are found,loop through them
//and make a form selection block
while ($row =mysql_fetch_array($result)){
$userID = $row['userID'];
$f_name = $row['f_name'];
$l_name = $row['l_name'];
$user_name = $row['user_name'];
$password = $row['password'];
$option_block = "<option value=\"$user_name\">$user_name $f_name,$l_name</option>";
}
//create the entire form block
$display_block = "
<FORM METHOD=\"POST \" ACTION=\"show_modUser.php\">
<P><strong>bike:</strong>
<select name=\"user_name\">
$option_block <option>$user_name $f_name,$l_name </option>;
</select>
<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this User\"></P>
</form>";