MySQL没有插入反斜杠

在MySQL中,当我尝试在表中插入反斜杠时,它不接受它,并为我提供了没有反斜杠的内容。

id 设置为自动递增:

INSERT INTO gender (sex, date) VALUES (

'male are allowed \ female are not allowed', "2012-10-06")

如何插入文字反斜杠?

Escape  Sequence    Character Represented by Sequence

\0 An ASCII NUL (0x00) character.

\' A single quote (“'”) character.

\" A double quote (“"”) character.

\b A backspace character.

\n A newline (linefeed) character.

\r A carriage return character.

\t A tab character.

\Z ASCII 26 (Control+Z). See note following the table.

\\ A backslash (“\”) character.

\% A “%” character. See note following the table.

\_ A “_” character. See note following the table.

回答:

您需要转义反斜杠:

INSERT INTO gender

(sex, date) VALUES (

'male are allowed \\ female are not allowed',

"2012-10-06")

参考(包含必须为mysql转义的所有字符的列表)

以上是 MySQL没有插入反斜杠 的全部内容, 来源链接: utcz.com/qa/417487.html

回到顶部