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.