RE: [PHP] Displaying a money datatype from mssql - Solution
| From: | Frank M. Kromann | Date: | Fri, 02 Apr 2004 21:20:45 +0000 |
| Subject: | RE: [PHP] Displaying a money datatype from mssql - Solution | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182188@lists.php.net to get a copy of this message | ||
This is a bug in php 4.3.5 and it's fixed in the upcomming 4.3.6 release.
- Frank
> Recap:
> In the query I had;
> SELECT totalamount
>
> And it was returning;
> Total Amount
> 5.41108926696E-309
>
> I tried to modify the query to;
> SELECT cast(totalamount as decimal(10,2)) as totalamount
>
> And php gave me an error;
> Undefined Index at line (x);
>
> When I tried to use 'number_format($totalamount,2)' it returned;
> Total Amount
> 0.00
>
> Solution:
> The solution was in the query;
> SELECT cast(totalamount as numeric(10,2)) as totalamount
>
> This returns the proper formatting;
> Total Amount
> 123.50
>
>
>
> 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.
> ******************************************************************
>
>
>