I am using the following coding in order to populate 15 lines on my form with selection boxes made up of products taken from the relevent table.
It works well BUT I am thinking that it is probably going to unnecassarily load the server and take time to create the page.
As the contents of my product table will not change while the form is created, should I first store these table elements in an array before the for loop is run and then use the array inside the loop ?
If so how do i do it ? OR will it not make any difference which way I do it ?
Your suggeestions are appreaciated.
for($i=0;$i<15;$i++)
{
<!-- PRODUCT DETAILS -->
<tr>
<td class = 'cb'><select name='prod[]'>";
<?php
$sql = "SELECT product FROM $client_table
WHERE account_type = 'PROD' ORDER BY 'product'";
$result = mysql_query($sql)
or die("Couldn't execute FIRST query.");
while($row = mysql_fetch_array($result))
{
if ($prod[$i] == $row[product]) {
echo " <option value = \"$row[product]\" selected= \"selected\" >$row[product]</option>";
} // endif
else {
echo "<option value = \"$row[product]\" >$row[product]</option>";
} // end else
}// end while loop
?>
</select></td></tr>
} // end for loop