Thursday, October 15, 2009
Can I use while in while?
Posted on 10:51 AM by programlover
Hello,
This is my query:
php Code:
<?
$query1 = "SELECT * FROM item WHERE order_reference_number='$ref'";
$portfolio = mysql_query($query1);
while($row1 = mysql_fetch_array($portfolio)) {
?>
<br />
<table width="100%">
<tr>
<td>
<input name="item_amount" type="text" value="<?=$row1['item_amount'];?>" size="2" /> of <input name="item_name" type="text" value="<?=$row1['item_name'];?>" size="30" /> </td>
</tr>
</table>
<? } ?>
I want to add a select box
php Code:
<select name="select2" id="select2">
<option value="Select">Select</option>
<?
$query3 = "SELECT * FROM material";
$portfolio1 = mysql_query($query3);
?>
<? while($row3 = mysql_fetch_array($portfolio1)) { ?>
<option>
<?=$row3['material_name'];?>
</option>
<? } ?>
</select>