Mysql_escape_string () function Usage Analysis, mysqlescapestring

Source: Internet
Author: User

Mysql_escape_string () function Usage Analysis, mysqlescapestring

This example describes the usage of the mysql_escape_string () function. We will share this with you for your reference. The details are as follows:

Use mysql_escape_string () to encode the data in question:

Some data, such:

Char query (1024); sprintf (query, "select * from my_tbl where name = '% S'", name );

If the name contains data such as "0 'Malley, Brian", a query statement is generated: select * from my_tbl where name = '0' Malley, brian.

The process of calling mysql_escape_string () is as follows:

My $ item = "aaa's bbb" my $ escape_item = mysql_escape_string ($ item );

In this case, the content of escape_item is aaa \'s bbb.

PS: this function has been deprecated in PHP5.3. Therefore, you only need to know about this function. It is not recommended.

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.