i tried it .. but it doesn't work 🙁
here is my code:
if($contents[product][0] != "")
{
$x = 0;
while($x != $cart->num_items($table,$session))
{
echo "<TR><TD>".$contents[name][$x]. "</TD><TD>".$contents[price][$x]. "</TD>\n";
$product = $contents[product][$x];
echo "<TD><INPUT TYPE=text size=3 name=quantity[$product] ";
echo "value=\"".$contents[quantity][$x]. "\"></TD>";
echo "<TD>\$".$contents[total][$x]. "</TD>\n";
echo "<TD><A HREF=\"view_cart.php?remove=".urlencode($contents[product][$x]);
echo "".(!$ShoppingCart? "&session=$session": ""). "\">Remove</A>";
// echo "$product";
$result1 = mysql_query("SELECT * FROM op WHERE product_id=$product AND session='$session'");
$op_row = mysql_fetch_array($result1);
$op = $op_row[product_id];
echo $op;
$result2 = mysql_query("SELECT * FROM options WHERE product_id=$op");
//$option_row = mysql_fetch_array($result2);
while( $option_row = mysql_fetch_row($result2))
{
print "<TR><TD colspan=\"2\">$option_row[name]</TD>
<TD colspan=\"2\">$option_row[price]</TD>
<TD>remove<TR>";
}
$x ++;
}
vincent wrote:
Ofcourse you can do a while within a while.
Just be carefull that the inner loop does not affect the condition of the outer loop.
things like this are a killer:
while ($t<$f)
{
while ($t<$g)
{
$f = $t + 2;
};
$t++;
};