Using the SUM Function in Joomla - Joomla! Forum - community, help and support
good day
i have directphp , jumi components installed in joomla 2.5.
i have tried performing 'sum' using php both jumi , directphp same results.
a snippet of code shown below:-
$tot_price = "select regno, sum(price) orders group regno";
$db->setquery($tot_price);
$tot_price_result = $db->loadobjectlist();
echo "<table border='1'>";
echo "<tr><th>reg no</th><th>total price paid</th></tr>";
foreach($tot_price_result $tpr) {
echo "<tr><td>";
echo $tpr->regno;
echo "</td><td>";
echo $tpr->sum(price);
echo "</td></tr>";
}
echo "</table>";
this not working. 'total price paid' field remains blank , rest of results displayed in table on white web page (joomla menu disappears etc)
ps:- when try using "select regno, sum(price) orders group regno"; in phpmyadmin (mysql) working fine.
can please me code?
thank you
i have directphp , jumi components installed in joomla 2.5.
i have tried performing 'sum' using php both jumi , directphp same results.
a snippet of code shown below:-
$tot_price = "select regno, sum(price) orders group regno";
$db->setquery($tot_price);
$tot_price_result = $db->loadobjectlist();
echo "<table border='1'>";
echo "<tr><th>reg no</th><th>total price paid</th></tr>";
foreach($tot_price_result $tpr) {
echo "<tr><td>";
echo $tpr->regno;
echo "</td><td>";
echo $tpr->sum(price);
echo "</td></tr>";
}
echo "</table>";
this not working. 'total price paid' field remains blank , rest of results displayed in table on white web page (joomla menu disappears etc)
ps:- when try using "select regno, sum(price) orders group regno"; in phpmyadmin (mysql) working fine.
can please me code?
thank you
make following changes , should work:
code: select all
$tot_price = "select regno, sum(price) total orders group regno";
...
echo $tpr->total;
Comments
Post a Comment