Home > Backend Development > PHP Tutorial > What is the meaning of backslash in MYSQL syntax?

What is the meaning of backslash in MYSQL syntax?

WBOY
Release: 2016-08-18 09:16:27
Original
2014 people have browsed it

SELECT function_baseurl.id AS id FROM function_baseurl WHERE TRUE

The previous sentence is a colleague’s code. He added backslashes to all fields, making the code particularly ugly. Is there any point in doing this?

Reply content:

SELECT function_baseurl.id AS id FROM function_baseurl WHERE TRUE

The previous sentence is a colleague’s code. He added backslashes to all fields, making the code particularly ugly. Is there any point in doing this?

Personally, I think this is telling the compiler to wrap the line! It feels like it doesn’t make much sense. Personal opinions are for reference only

Excuse me, is it ` or

<code>` 是 mysql 的转义符,只要你不在列名、表名中使用 mysql 的保留字或中文,就不需要转义
其他数据库也同样有保留字,如使用的话也同样需要转义,只是转义符不同而已</code>
Copy after login
<code>\ 是对字段输入内容的转义,以确保这些数据不会引起程序,特别是数据库语句因为特殊字符引起的污染而出现致命的错误。在magic_quotes_gpc=On的情况下,如果输入的数据有单引号(’)、双引号(”)、反斜线()与 NUL(NULL 字符)等字符都会被加上反斜线。这些转义是必须的。</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template