Hi,


1. I create a table in mysql:

create table hh
(
id double(3,2)
);

2.

[ insert into hh
values(27.22)

insert into hh
values(7.49)

3.

select * from hh

result
9.99
7.49

why i get 9.99 why not 27.22?

Thanks.

When I test your code, the line

insert into hh values(27.22);

results in the mysql error 1264: Out of range error for column id You have to define the double field with as much decimal places as needed. Change the table definition to

create table hh (id double(5,2));

and it will work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.