Jump to content

SUM Function


sam06

Recommended Posts

My Query is to find the SUM of all values in the 'Value' column where the Username = $username

 

 

$result = mysql_query("SELECT username, SUM(Value) FROM clicks GROUP BY username WHERE username='$username'") or die(mysql_error());
$name = mysql_result ($result, 0, 'Username');

 

I am then going to use that result in a sentance like

Your total amount is '$name'

 

Many Thanks,

Sam

Link to comment
https://forums.phpfreaks.com/topic/113465-sum-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.