Answers for "suming items in the display table in php"

PHP
4

calculate sum (total) of column in php

mysql_connect($hostname, $username, $password);
mysql_select_db($db);

$sql = "select sum(column) from table";
$q = mysql_query($sql);
$row = mysql_fetch_array($q);

echo 'Sum: ' . $row[0];
Posted by: Guest on October-11-2021
1

sum of the array elements in php

Return the sum of all the values in the array (5+15+25):

<?php
$a=array(5,15,25);
echo array_sum($a);
?>
Posted by: Guest on June-29-2020

Code answers related to "suming items in the display table in php"

Browse Popular Code Answers by Language