demon_athens Posted May 28, 2007 Share Posted May 28, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/ Share on other sites More sharing options...
Illusion Posted May 28, 2007 Share Posted May 28, 2007 try TRUNCATE() Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263149 Share on other sites More sharing options...
demon_athens Posted May 28, 2007 Author Share Posted May 28, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263153 Share on other sites More sharing options...
demon_athens Posted May 28, 2007 Author Share Posted May 28, 2007 never mind, I solved it with php. Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263192 Share on other sites More sharing options...
Illusion Posted May 28, 2007 Share Posted May 28, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-263198 Share on other sites More sharing options...
demon_athens Posted May 30, 2007 Author Share Posted May 30, 2007 ok sorry then. Quote Link to comment https://forums.phpfreaks.com/topic/53255-solved-long-float/#findComment-265106 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.