Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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];
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #calculate #sum #column #php
ADD COMMENT
Topic
Name
5+1 =