I stuck on this,
I want to create a table with 10 rows, each row having “same drop down menu” of 10 products. But in every row different product selected. example in first row first product in second row second product and so on. The bellow code is showing drop down menu in each row but every row have first product selected. How can I select next product for next row?
<table>
<tr>
<td>
<select>
<?php
$query = "SELECT * FROM table_name WHERE featured=1 LIMIT 10";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result)){
echo "<option>".$row["product_name"]."</option>"
}
?>
</select>
</td>
<td>
<select>
<?php
$query = "SELECT * FROM table_name WHERE featured=1 LIMIT 10";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result)){
echo "<option>".$row["product_name"]."</option>"
}
?>
</select>
</td>
</tr>
</table>
1 Answer