如何使用explode()将查询值拆分为多个选择标记的行

I have in the column size values for each query, e.g. 38 40 42 44, and I want then to select the size field and separate it (using explode()) to give the option to select after a select tag html. I used explode() to split the number after black space but the code is not giving me all the results in multiple rows

$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
        while ($row = mysql_fetch_array($sql)) {
            $product_name = $row["product_name"];
            $price = $row["price"];
            $size = $row["size"];    
$myArray = explode(' ',  $size);
            foreach($myArray as $my_Array){
                            }

<select name="size"><option value="'.$my_Array.'">'.$my_Array.'</option>
<select name="size"><option value="'.$my_Array.'">'.$my_Array.'</option>

but the code is showing me only the first value like 38...And I want to show how many numbers are in the value. Show for each a select tag with the value, to give the option to be selected by the user. I don't know what i missed.

EDIT Thanks to ddp I fixed the problem, it was with the closing the loop function too early.

//assuming that `size` is stored as 38 40 42 in the same row
//also assuming your LIMIT 1 is for testing, if not, you don't need the loop
/** PLEASE CHANGE TO MYSQLI OR PDO! mysql_ is depreciated and a huge security risk **/ 
$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
    while ($row = mysql_fetch_array($sql)) {
        $product_name = $row["product_name"];
        $price = $row["price"];
        $size = $row["size"];    
        myArray = explode(' ',  $size);
        //heres your issue, declare select to start with
        echo '<select name="size">';
        foreach($myArray as $my_Array){
             //the out put from your explode loop array needs to go here
             echo '<option value="'.$my_Array.'">'.$my_Array.'</option>';
        }
        echo '</select>';
}//close the while loop

The problem is in your foreach($list as $value){ ... } you named the loop the same as the list and it might be rewrited.

The foreach loop ending } is in to wrong place. You do not do anything in the loop.