Jump to content

[SOLVED] Shooping Cart Issues


pwes24

Recommended Posts

It depends how you're storing the information on the products in the shopping cart. If you're using a database, then perhaps you could store all the prices in an array then use 'array_sum' to get the total. Something like

 

<?php

$sql = 'SELECT * FROM myTable';

$result = mysql_query( $sql );

while ( $row = mysql_fetch_array( $result ) )
{
  $price[] = $row['product_price'];
}

$total_price = array_sum( $price );

?>

 

As for your second question, the user above suggested HTML tables:

 

<table cellspacing="0" cellpadding="0">
<tr>
<?php while ( $row = ..... ) : ?>
<td><?php echo $row['product_name']; ?></td>
<?php endwhile; ?>
</tr>
</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.