Home  >  Article  >  Backend Development  >  Analysis of the difference between addslashes and mysql_escape_string in PHP, mysqlescapestring_PHP tutorial

Analysis of the difference between addslashes and mysql_escape_string in PHP, mysqlescapestring_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:53:28943browse

Analysis of the difference between addslashes and mysql_escape_string in PHP, mysqlescapestring

This article analyzes the difference between addslashes and mysql_escape_string in PHP. Share it with everyone for your reference, the details are as follows:

1.The two have basically the same meaning when inserting data. The only difference lies in addslashes

Convert " '" to " ' '" when magic_quotes_sybase=on

Convert " '" to " '" when magic_quotes_sybase=off

And mysql_escape_string always converts " '" to " '"

2.mysql_escape_string will be abandoned in php6, so it is best to avoid using it .

And it is best to use the object-oriented mysqli::real_escape_string,

If you have to use process-oriented, you can use mysql_real_escape_string

Readers who are interested in more PHP-related content can check out the special topics of this site: "PHP Data Structure and Algorithm Tutorial", "Summary of PHP Operations and Operator Usage", "Summary of PHP Network Programming Skills", "PHP Basic Syntax" "Introductory Tutorial", "Summary of PHP Office Document Skills (Including Word, Excel, Access, PPT)", "Summary of PHP Date and Time Usage", "Introduction to PHP Object-Oriented Programming", "php String Usage" Summary", "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone in PHP programming.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1123838.htmlTechArticleAnalysis of the difference between addslashes and mysql_escape_string in PHP, mysqlescapestring This article analyzes the difference between addslashes and mysql_escape_string in PHP. Share it with everyone for your reference, specifically...
Statement:
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