For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > December 2007 > Re: [PHP-DB] decimal point









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] decimal point
Ron Piggott

2007-12-15, 10:09 pm


INSERT INTO rate_plans VALUES ( '12', 'One W', '1', '2', '2',
'8.00' )

When I use

$advertisement_rate = mysql_result($rate_plan_result,0,"rate");

$advertisement_rate has a value of 800 instead of 8.00 --- how can I get
my 2 decimal places back?

Ron

On Sat, 2007-12-15 at 18:18 -0800, Micah Stevens wrote:[color=darkred]
> What's your insert statement?
>
> On 12/15/2007 05:11 PM, Ron Piggott wrote:
Micah Stevens

2007-12-16, 3:59 am

If I make a test table with a field that is DECIMAL(4,2), I can:

INSERT INTO `testaa` ( `a` )
VALUES (
'8.00'
)

Then I can
SELECT * FROM `testaa`

I get '8.00' from the 'a' field.

It looks like you're using an abstraction library? Perhaps that's the
problem?

-Micah



On 12/15/2007 07:13 PM, Ron Piggott wrote:
> INSERT INTO rate_plans VALUES ( '12', 'One W', '1', '2', '2',
> '8.00' )
>
> When I use
>
> $advertisement_rate = mysql_result($rate_plan_result,0,"rate");
>
> $advertisement_rate has a value of 800 instead of 8.00 --- how can I get
> my 2 decimal places back?
>
> Ron
>
> On Sat, 2007-12-15 at 18:18 -0800, Micah Stevens wrote:
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com