意外的字符。 (在“?”附近)

时间:2019-06-03 04:45:01

标签: mysql

我试图在phpMyAdmin中执行以下查询,并且发生错误。我已经看过类似的问题,但是我仍然不知道为什么它不起作用。

INSERT INTO discussion_forum (event_type, title) VALUES ('edx.forum.thread.viewed', 'Which of the stories you've seen or read can you relate to? Why?')

静态分析是

3 errors were found during analysis.

Unexpected character. (near "?" at position 143)
Unexpected character. (near "?" at position 148)
Ending quote ' was expected. (near "" at position 151)

谢谢您的时间。

3 个答案:

答案 0 :(得分:4)

通过加倍转义'

'Which of the stories you''ve seen or read can you relate to? Why?'

答案 1 :(得分:1)

您的字符串中带有引号('),应使用反斜杠(\)对其进行转义

INSERT INTO discussion_forum (event_type, title) VALUES 
('edx.forum.thread.viewed', 'Which of the stories you\'ve seen or read can you relate to? Why?')

答案 2 :(得分:0)

您的问题是“ this”,因此您需要像下面这样更改

INSERT INTO discussion_forum (event_type, title) VALUES ('edx.forum.thread.viewed', 'Which of the stories you\'ve seen or read can you relate to? Why?')