I'm having a minute issue with nested loops.I've two tables product and product_option Every product has an option,price Example Ring($25) with option red($.50) and yellow($.75). So the table is something like this product(id,price,description) and product_option(product_id,optionname,optionprice) When I fetch data from php the output should look something like this Ring($25) total -price 25.75 red(.50),yellow(.25)
Ama benim çıktı böyle bir şey gösterilir
Ring($25)
red(.50),red(.50)
Aşağıda, kod
session_start();
require_once './classes/cartclass.php';
$val = new carts();
While($cartContent = mysql_fetch_assoc($cartContents))
{
if($cartContent['ctsid']==session_id())
{
$cartid=$cartContent['ctid'];
$subTotal += $cartContent['ctprice'] * $cartContent['ctqty'];
echo $cartContent['iname'];
echo $cartContent['mprice'];
echo $cartContent['mdesc'];
$count=mysql_num_rows($val->getCartopt($cartid));
if($count>0){
$CartOpt = mysql_fetch_assoc($val->getCartopt($cartid));
foreach($CartOpt as $Cartopts){
echo $CartOpts."".$CartOpt['ctopname'];
$i++;
if($i==$count)
break;
}
}
}
}