Home > Article > Backend Development > Analysis of the difference between addslashes and mysql_escape_string in PHP, mysqlescapestring_PHP tutorial
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.