Home > Backend Development > PHP Tutorial > MySQL的VARCHAR字段的有关问题

MySQL的VARCHAR字段的有关问题

WBOY
Release: 2016-06-13 13:42:09
Original
807 people have browsed it

MySQL的VARCHAR字段的问题
mysql中的varchar字段,为什么插入00555的记录时,表中存储的是555!怎么保证必须是00555呢?

------解决方案--------------------
`varcharfield`= '00555 '

值为00555的变量注意不要是整型
------解决方案--------------------
'00555 '
------解决方案--------------------
引号...
------解决方案--------------------
是啊,千万不要这么赋值啊:
insert into(myvarchar) values(00555)
而是这样:
insert into(myvarchar) values( '00555 ')

------解决方案--------------------
按字符串插入数据,就不会存在你说的情况。
------解决方案--------------------
应该是你在插入的时候没加引号,所以当成int来处理了.
------解决方案--------------------
同意,是这问题

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