This question already has an answer here:
Having a lot of problems, I am using SUM on a field in my table and it works but only with one decimal place, I need it to be in currency format, I have tried the below code and others but nothing
$query = "SELECT purchase concat('$', sum(purchase), 2) from dtable";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['SUM(purchase)'];
echo "<br />";
}
</div>