Jump to content

[SOLVED] Array_sum in table column


pwes24

Recommended Posts

<?php
while ($row = mysql_fetch_assoc($result))
{
     $array[] = $row['total_price'];
}

$total = array_sum ($array);
?>

 

OR

 

<?php
$result = mysql_query ("SELECT SUM(total_price) FROM cart");
$total = mysql_result ($result, 0);
?>

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.