2013-03-21 146 views
0

我有以下MySQL查询:Mysql的语法错误(我无法找到是什么错误!)

REPLACE INTO application (export_date,application_id,title,recommended_age,artist_name,seller_name,company_url,support_url) VALUES (1362564068339,564783832,Eyelashes,4+,Char Room,Char Room,http://,http://ios.charroom.net/,http://itunes.apple.com/app/) 

我收到以下错误:

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 'Char Room,Char Room,http://,http://ios.charroom.net/,http://itunes.apple.com/app' at line 1 

我似乎无法看到的错误是。有人可以帮我吗?

您必须知道上述内容是实际查询的回声。在查询之前,此查询中的所有参数都经过了mysql_real_escape_string。

回答

0

您必须在数据中插入数据的引号。

3

嗯,首先你shouldn't be usingmysql_real_escape_string

This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.

其次,你仍然需要把周围的字符串引号。 mysql_real_escape_string将在字符串内转义引号,但不会将引号添加到开始和结尾。

+0

谢谢,正确的答案。 – 2013-03-21 22:08:23

+0

*最后*,只有大约十年(或两年)慢的派对.. – 2013-03-21 22:09:51