Home > Backend Development > PHP Tutorial > mysql float怎样保存小数啊解决方法

mysql float怎样保存小数啊解决方法

WBOY
Release: 2016-06-13 10:09:25
Original
1950 people have browsed it

mysql float怎样保存小数啊
我设置一个字段类型为float ,但是插入小数,保存到数据库里就成了整数了
我在网上看把float 改成float(5,2)就能保存两位小数了,不超过5位数字,
这个5,2在哪设置的啊,我把长度改成5,2就报错了

------解决方案--------------------
phpmyamin中 长度中不可以改吗?
------解决方案--------------------
create table test (float_column float(5,2) not null default 0);
不会报错。mysql 5.1

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template