MySQL 查询语法 转义字符串上的错误


INSERT INTO `5` VALUES ('photo', 'headline', 'LA Lakers', 'http://facebook.com/NUMBER', 'Here's video from the An...', 'NUMBER', 'http://www.facebook.com/NUMBER/posts/NUMBER', 'NUMBER'), 'https://graph.facebook.com/NUMBER/picture?access_token=AAAGGhZBZB1ZCf4BAD1fNpORWVGtWhUI5u**********************&type=normal')

尝试此查询时出现此错误:

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 ''https://graph.facebook.com/NUMBER/picture?access_token=AAAGGhZBZB1ZC' at line 1

在 php 函数 mysql_real_escape_string 转义单个值(不是整个查询(之后。

我已将所有配置文件 ID 更改为字符串 NUMBER,并在访问令牌中添加了星号以保护我的隐私。这些通常不存在。

试试这个;最后一个参数在括号之外。

INSERT INTO `5` VALUES ('photo', 'headline', 'LA Lakers', 'http://facebook.com/NUMBER', 'Here's video from the An...', 'NUMBER', 'http://www.facebook.com/NUMBER/posts/NUMBER', 'NUMBER', 'https://graph.facebook.com/NUMBER/picture?access_token=AAAGGhZBZB1ZCf4BAD1fNpORWVGtWhUI5u**********************&type=normal')

您忘记了插入查询最后一个值中的圆括号...
此外,在表名中使用撇号...
喜欢这个:

INSERT INTO '5' VALUES ('photo', 'headline', 'LA Lakers', 'http://facebook.com/NUMBER', 'Here's video from the An...', 'NUMBER', 'http://www.facebook.com/NUMBER/posts/NUMBER', 'NUMBER', 'https://graph.facebook.com/NUMBER/picture?access_token=AAAGGhZBZB1ZCf4BAD1fNpORWVGtWhUI5u**********************&type=normal')

INSERT INTO 5 VALUES (...), 'https://graph.facebook.com/NUMBER/picture?access_token=AAAGGhZBZB1ZCf4BAD1fNpORWVGtWhUI5u**********************&type=normal'

看看你的括号,它们过早结束,这可能是错误。

相关内容

最新更新