Hi
I have a column 'profit', I want to show the sum of them.
here is the code:
$totalprofit=0;
$query2 = "SELECT profit FROM client";
$result2 = mysql_query($query2);
while($row = mysql_fetch_array($result2))
{
$totalprofit = $profit + $totalprofit;
}
echo $totalprofit;
The sum of all profit should be positive, but it shows a negative number. What's wrong with $totalprofit = $profit + $totalprofit?
Thanks