winelover Posted September 8, 2010 Share Posted September 8, 2010 Hi, I have a page on which decimal values are entered. The problem is however that sql does not recognize the comma (the european decimal separator) as the decimal separator. How can I change the input to something that sql can accept? And what if someone enters a number in English format (a dot instead of a comma)? Or uses thousands-separators? Has anyone have experience with this? Greetz, Winelover Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted September 8, 2010 Share Posted September 8, 2010 Can't you accept european decimals but store the values in normal dot decimals and then format the output to show in european decimals again. That way, it really does not matter how they enter their decimal. Of course, you will have to do validation and reformatting of the input they type in. This will either have to be done client side of server side but if I was you, I would probably check it server side again before I wrote it away to the database anyway. Quote Link to comment Share on other sites More sharing options...
litebearer Posted September 8, 2010 Share Posted September 8, 2010 http://forums.mysql.com/read.php?21,362125,362670 Quote Link to comment Share on other sites More sharing options...
winelover Posted September 10, 2010 Author Share Posted September 10, 2010 Thanks for the replies. The formatting is not the problem. The problem is more the input. I wanted to give the possibility to enter the amount with either a dot or a comma. And also check if one entered thousands separators or not. Now I added a little JavaScript to accept only one optional comma and numbers and the replace the comma with a dot before storing in the database. Problem solved. Quote Link to comment 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.