PDA

View Full Version : a comma into an int



traxion
03-29-2007, 04:45 PM
hey

i got a problem

i got a field in my database
aantal decimal(5,2)

when i try to full it it doesn't works (correctly)
when i put 15.21 into it it works great
but when i put 15,21 into it the field will be 15

i think that is because he dont get the comma.. is that correct? and does anyobdy has a solution

dont come up with u need to write a . :P

this info i got from phpinfo(); .. i u want more info just ask i will try my best then

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value

guelphdad
03-29-2007, 08:42 PM
store it as a decimal and then use REPLACE when you pull your data out and display it.

similarly store it as a decimal and then use PHP or whatever to do the substitution.

On a different note, your version of mysql is severely out of date, you should look into upgrading it.

felgall
03-29-2007, 09:52 PM
All computer programs use . as the decimal point and not , so you need to convert the , to a . before you can treat the field as a number.

traxion
03-30-2007, 08:52 AM
On a different note, your version of mysql is severely out of date, you should look into upgrading it.

jep but unfortinualy it is mine server of the work.. where i dont got the manage of it


i will use the . in the future in stead of the , or i will build some script for it

thnx for the info

guelphdad
03-30-2007, 01:47 PM
jep but unfortinualy it is mine server of the work.. where i dont got the manage of it

Workplaces do stupid things don't they? 3.23.49 was released in February 2002. They are three major releases behind!