How do I correctly display a money datatype from a mssql db?

I've looked through the archives and come up empty, and google doesn't seem
to have anything worth mentioning.

My query is;

SELECT od.price, od.inventorycost, om.totalamount

FROM   orderhistorymaster as om, orderhistorydetail as od

WHERE  om.ordernumber = od.ordernumber and 
       om.customernumber = '$custnum' and
       od.entrydate = om.entrydate and om.entrydate between
       '$startdate' and '$enddate'

ORDER BY om.entrydate

When I run the query, for the fields 'price' and 'totalamount', I get a
return of;
Price
1.59149684322E-310

Total Amount
5.41108926696E-309

So I tried;
SELECT cast(od.price as decimal(10,2)), cast(od.inventorycost as
decimal(10,2)),                  cast(om.totalamount as decimal(10,2))

But php didn't like that.

In Query Analyzer they come up;
Price
.7500

Total Amount
25.5000

My last resort would be to go into the db and do a conversion there but I
really don't want to do that.
How can I convert these to represent a readable dollar figure?

alex hogan


****************************************************************** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
****************************************************************** 


Reply via email to