Hello, This is my query: <? $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> <? } ?> PHP: I want to add a select box <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> PHP:
Ok. never mind. This is working perfect. I was saving under another file name. that is why it was not working
Just for references of other visitors and members... You can use while in a while... there is no such restriction. You should just be carefull about cpu/ram usage since a loop inside a loop may search data in millions of rows according to number of rows in tables. Regards,
Correct, and since the while loop you have in the while is simply receiving the same data from the database for every row, you would do better to save this in an array outside of the while loops and then simply reference that array with foreach.