Page 1 of 1

decimal dilemma [Solved]

Posted: Tue Feb 08, 2005 7:20 pm
by C_Calav
hi guys,

my feild in my DB is
decimal(10,0)
but when i put for instance 67.50 into the DB it comes out as 67.

can anyone help me with what i am doing wrong?

thanx !

Posted: Tue Feb 08, 2005 7:23 pm
by timvw
that is more or less "expected behaviour", so i don't see what your problem is?

http://dev.mysql.com/doc/mysql/en/numeric-types.html

Posted: Tue Feb 08, 2005 7:27 pm
by C_Calav
Hi Timvw,

how can i get it to insert as 67.50 (two dp)

what do i need to change i didnt see how to get two DP in the link

Posted: Tue Feb 08, 2005 7:28 pm
by C_Calav
do i change it to
decimal(10,2)
?

but how..

Posted: Tue Feb 08, 2005 7:31 pm
by timvw
phpmyadmin tells me it should be something like:


ALTER TABLE `test` CHANGE `decimal` `decimal` DECIMAL( 10, 2 ) DEFAULT '0' NOT NULL

Posted: Tue Feb 08, 2005 7:32 pm
by C_Calav
thank you very much