Practical application of MySQL escape characters

Source: Internet
Author: User

Today we mainly describe php and MySQL escape characters. We all know that the actual proportions of php and MySQL escape characters are still the majority. If you use this technology, if you are curious, the following articles will unveil its mysteries.

For details about escape characters in php and MySQL, there is a magic quotes in the setting file, which is opened by default. We recommend that you disable it. At first, the default settings are used to make development easier, and the actual situation is the same.

When the program learns a certain degree, it gradually tends to close this option.

The advantage of doing so is to make the program more logical and easy to control. After the preceding option is enabled, php will escape single quotes, double quotation marks, backslash (/), and null strings, and replace them with: \ '\ "\ 0, this improves security and prevents injection attacks. However, this can be easily done through a program.

When MySQL writes data to the database, it must process the strings and escape the above four types of characters. In this way, if magic quotes is set to on, no escape is required. on the surface, it seems easy, in fact, it is easy to confuse and cause logical confusion. Therefore, we recommend that you set magic quotes to off. For MySQL escape characters, write a simple escape function. This makes it easier to control php and control MySQL.

 

The above content is an introduction to the study of MySQL escape characters. I hope you will get something better.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.