decimal dilemma [Solved]

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

decimal dilemma [Solved]

Post 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 !
Last edited by C_Calav on Tue Feb 08, 2005 7:32 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post 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
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

do i change it to
decimal(10,2)
?

but how..
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

phpmyadmin tells me it should be something like:


ALTER TABLE `test` CHANGE `decimal` `decimal` DECIMAL( 10, 2 ) DEFAULT '0' NOT NULL
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thank you very much
Post Reply