I am having a problem with a piece of code and its result.I have a list of prices on my table and i want the sum to be displayed at the bottom but the problem is that, i am not able to get the correct sum. Here is the code; and i uploaded the result also
<?php
$db =& JFactory::getDBO();
$query = "SELECT CONCAT('P', format(SUM(`price`),2)) AS `total_price`FROM `#expenditure`";
$db->setQuery($query);
$total_price = $db->loadResult();
echo "<strong>";
echo "Total Cost:";
echo $total_price;
echo "</strong>";
?>