数据库为什么会变为这样

WBOY
Release: 2016-06-13 12:26:45
Original
1036 people have browsed it

数据库为什么会变成这样?
我在使用PHP向数据库中插入数据时发现一个问题,当插入一个字段类型为varchar的值时,无论插入的内容是多少个0,数据库都默认认为是一个0。请教大神。why?这种情况该怎么处理。
------解决思路----------------------
INSERT INTO user (PhoneNumber,Password) VALUES ('12312312312','000000')

请加上单引号,谢谢
------解决思路----------------------
你把0 加上引号试试。
------解决思路----------------------
字符类型,sql语句里要给加上单引号
------解决思路----------------------
字符串需要用引号包围,否则会转为数字,00000转数字就是0,所以数据库中保存的就是0了。
------解决思路----------------------
varchar为字符类型
当你insert数据的时候,字符串变量需要加上引号。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!