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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.