Home > Backend Development > PHP Tutorial > 为什么表中插入不了数据呢?

为什么表中插入不了数据呢?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:18:46
Original
1450 people have browsed it

建表语句如下:create table user(id int,username varchar(20),password varchar(20));
我这样插入却提示错误啊 为什么?我这个不是英文版的 所以看不懂 反正提示的就是ming什么什么的 insert into user values(1,ming,11111);

回复内容:

建表语句如下:create table user(id int,username varchar(20),password varchar(20));
我这样插入却提示错误啊 为什么?我这个不是英文版的 所以看不懂 反正提示的就是ming什么什么的 insert into user values(1,ming,11111);

varchar类型要加单引号,表明是字符串,int,直接写数字,不用单引号

你还没理解 SQL 里的数据都是有类型的吧,你这么写 ming 是把它当作关键字来用,但你想要做的是写一个字符串吧。

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template