RE: [PHP-DB] subtotal
| From: | Michael Norton | Date: | Wed, 14 Feb 2001 17:53:15 +0000 |
| Subject: | RE: [PHP-DB] subtotal | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6627@lists.php.net to get a copy of this message | ||
There is a ROUND function in MySQL...try this:
$totalsql = "SELECT ROUND(SUM(total),2) FROM entry WHERE
user_id='$passedid'";
$totalresult = mysql_query($totalsql);
$totalrow = mysql_fetch_array($totalresult);
print "<P>Total : $totalrow[0]</P>";
--Mike Norton
-----Original Message-----
From: bryan [mailto:bryan@concept-factory.com]
Sent: Wednesday, February 14, 2001 1:56 PM
To: db
Subject: [PHP-DB] subtotal
Good day all...
Does anyone know how, if I have a "*.00" at the, I can just leave that on?
When I round, it does round,
but, if I have a total of $13.00, I want it to read ($13.00) not ($13).
here is my weak, but working code...
****************************************************************************
************
$totalsql = "SELECT SUM(total) FROM entry WHERE user_id='$passedid'";
$totalresult = mysql_query($totalsql);
$totalrow = mysql_fetch_array($totalresult);
print "<P>Total : ".round($hoursrow[0], 2)."</P>";
****************************************************************************
***********
thanks...
Bryan Fitch
Programmer
Concept Factory
bryan@concept-factory.com
http://www.concept-factory.com