...

View Full Version : why i can not have value as decimal in my table ?



kamkam
09-11-2009, 01:26 PM
Hi;
why i can not have value as decimal in my table ?

1) i created a table in mysql.


create table mytable(id smallint auto_increment primary key,
price decimal)


Then i tried to insert value like 7.99, but final result for the price in my table is 7, not 7.99. Could you help me, please.


mysql_query("INSERT INTO mytable (price)
VALUES ('7.99")");

kamkam
09-11-2009, 01:57 PM
Thanks a lot, i have solved th problem already.

kbluhm
09-11-2009, 03:06 PM
For future reference, SMALLINT fields can only whole integers.

To hold a float value, it must be FLOAT, DOUBLE, or DECIMAL.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum