Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Array sum

$
0
0

OOo the 4 hours of cirlces iv travled on this one.

echo "<table border='1'>
<tr>
<th>Category</th>
<th>Value</th>
<th>Date</th>
<th>AddedUp</th>
</tr>";
$result = $con->query($Totals);
while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row[0] . "</td>";
  echo "<td>" . $row[2] . "</td>";
  echo "<td>" . $row[1] . "</td>";
  echo "<td>" . array_sum($row[2]) . "</td>";
  echo "</tr>";
  }
echo "</table>";

Iv been tring to get it to  add all the vaules in row [2]. Below is the table but i can get teh "Values" added up.

 

 

I was wanting the total of "Value" to be at the bottom of the table but every combination i try to add or sum it up wont work. Yes i tried array_sum, might nt have used it correctly but did try. IF anyones got an idea please chime in :)

Attached Thumbnails

  • clip.png

Viewing all articles
Browse latest Browse all 13200

Trending Articles