Jump to content

[SOLVED] Long float?


demon_athens

Recommended Posts

Hi there,

 

I want to have prices for products that can be 12.000.000 or 5.000 or 5,20 or 13.850,70. I had a float(10,2) but the client wants to put if needed the decimal separator ",". For example a price of 12.000.000 is returned like 12.000.000,00 and he doesn't want that.

 

Also in order to have the decimal numbers I have to write the character "." not ",". So I must write it 12000000 (without the dots because it will give decimals)

 

Any ideas what can I do? I know its too common for someone with experience :) I don't use floats often so I really don't know that to do here.

Link to comment
https://forums.phpfreaks.com/topic/53255-solved-long-float/
Share on other sites

TRUNCATE TABLE empties a table completely. Logically, this is equivalent to a DELETE  statement that deletes all rows, but there are practical differences under some circumstances.

 

Are you kidding me?

 

I studied the structure of oscommerce. For price fields has decimal(15,4). After searching I saw that you can set the decimal and thousands character. So I wonder if they use php to make the string of price on runtime.

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263153
Share on other sites

TRUNCATE TABLE empties a table completely. Logically, this is equivalent to a DELETE  statement that deletes all rows, but there are practical differences under some circumstances.

 

Don't you see, I written it as TRUNCATE() not TRUNCATE.

TRUNCATE() is function which removes the digits after the decimal point if you don't pass second argument.

Link to comment
https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263198
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.