Forum Moderators: coopster
SELECT
userName,
SUM [dev.mysql.com](payAmount) AS annualSalary
FROM weeklyPaychecks
WHERE
userName = 'Me' AND
payDate BETWEEN '2005-01-01' AND '2005-12-31'
GROUP BY userName
;
My code now looks like:
$TotalHits = mysql_query("SELECT SUM('counter') AS 'num' FROM BnBData") or die(mysql_error());
$Hits = mysql_fetch_array($TotalHits);
I don't mean to be moving (practically) step by step, but this is quite new to me. The column I'm adding is set as an INT column. I can't figure out why it wouldn't add the values of each row together.
$TotalHits = mysql_query("SELECT SUM('counter') AS 'num' FROM BnBData") or die(mysql_error());
$Hits = mysql_fetch_array($TotalHits);
$Hits = $Hits['num']; [0] => 0 [num] => 0
The code I'm using to sum the column is:
$TotalHits = mysql_query("SELECT SUM('counter') AS 'num' FROM BnBData") or die(mysql_error());
$Hits = mysql_fetch_array($TotalHits);
I'm just not seeing what else I can do!
EDIT:
I just tried to remove the apostrophes, and that did it!
Thanks!