something is wrong with my array
| From: | J-E-N | Date: | Thu, 11 Oct 2001 06:33:28 +0000 |
| Subject: | something is wrong with my array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13223@lists.php.net to get a copy of this message | ||
please help... my script below does not work as it should. i think theres something wrong with my
array ...
// Query items ordered
$sql = "select qty,productdesc,productsize,productprice from tblCart c, tblProduct p WHERE
p.prodid=c.prodid and c.cartid='".$cartid."' ORDER BY productdesc";
$query = ibase_query($sql);
$total=0;
$Count=0;
while ($Coutrow = ibase_fetch_row($query)) {
$subtotal = $Coutrow{3} * $Coutrow{0};
$total = $total + $subtotal;
if ($BoughtCount==0) {
$ProdArray =
array(qty=>$Coutrow{0},prodname=>$Coutrow{1},prodsize=>$Coutrow{2},prodprice=>number_format($Coutrow{3},2),prodtotal=>number_format($subtotal,2));
} else {
$ProdArray =
$ProdArray.",".array(qty=>$Coutrow{0},prodname=>$Coutrow{1},prodsize=>$Coutrow{2},prodprice=>number_format($Coutrow{3},2),prodtotal=>number_format($subtotal,2));
}
$Count ++;
}
// Display items ordered
$CartItems = array ($ProdArray);
for ($i=0; $i<=$Count; $i++) {
print "<tr><td width=\"10%\" align=\"right\"
class=\"prodtxt\">".$CartItems[$i][qty]."</td>
<td align=\"left\"
class=\"prodtxt\">".$CartItems[$i][prodname]."</td>
<td align=\"right\"
class=\"prodtxt\">".$CartItems[$i][prodsize]."</td>
<td align=\"right\"
class=\"prodtxt\">".number_format($CartItems[$i][prodprice],2)."</td>
<td align=\"right\"
class=\"prodtxt\">".number_format($CartItems[$i][prodtotal],2)."</td></tr>";
}
thanks in advance