sethupathy Posted June 22, 2007 Share Posted June 22, 2007 hi guys here is my new problem because i have french users that will be entering data to my web form and there is questions with answers that require that enter data in money value 245.45 or like some users in french they use a 245,45 (comma) i am having problem with how mysql handles the money value when there is a comma the data is after the comma is missing i am using decimal 7,2 in mysql. is there a way that the semicolon becomes a . when the data is entered by the user? or is there a way around that pls any input much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/56646-solved-php-help-web-form/ Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 double(6,2) is that what you mean that works upon creating a field in a table Quote Link to comment https://forums.phpfreaks.com/topic/56646-solved-php-help-web-form/#findComment-279750 Share on other sites More sharing options...
snowman15 Posted June 22, 2007 Share Posted June 22, 2007 I'm kind of new in php but i will try to base this off the other programming languages i know and maybe something can spark your idea. There might be a way to get the value as a string. From there, find the place value of the comma and change it into a period via string manipulation. Then use a manual function to change it from a string into a double or integer. So basically my idea would be gather the information as a string, change all comma's to periods using string manipulation, and change it into a double or integer afterward. Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/56646-solved-php-help-web-form/#findComment-279949 Share on other sites More sharing options...
corbin Posted June 22, 2007 Share Posted June 22, 2007 $money = $_GET['money']; $money = str_replace(",", ".", $money); PHP flows between data types fairly well. That should work perfectly. (Actually, get requests are handled as strings, anyway, but what ever ;p) Quote Link to comment https://forums.phpfreaks.com/topic/56646-solved-php-help-web-form/#findComment-279959 Share on other sites More sharing options...
sethupathy Posted June 22, 2007 Author Share Posted June 22, 2007 Corbin you rock thanks a bunch mate works great problem solved Quote Link to comment https://forums.phpfreaks.com/topic/56646-solved-php-help-web-form/#findComment-280085 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.