首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

帮小弟我看看这句insert语句有什么错

2012-06-20 
帮我看看这句insert语句有什么错?执行这条语句insert into chinaipv4 (from,to) values (1.50.0.0,1.50

帮我看看这句insert语句有什么错?
执行这条语句insert into chinaipv4 (from,to) values ('1.50.0.0','1.50.255.255');
总是提示:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'from,
to) values ('1.50.0.0','1.50.255.255')' at line 1
表结构如下:
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| from | varchar(16) | YES | | NULL | |
| to | varchar(16) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+

[解决办法]
MySQL的话这样
insert into `chinaipv4` (`from`,`to`) values ('1.50.0.0','1.50.255.255');
[解决办法]
from 是 mysql 保留字,挪作他用时需转义 `from`

[解决办法]

探讨

MySQL的话这样
insert into `chinaipv4` (`from`,`to`) values ('1.50.0.0','1.50.255.255');

热点排行