Analysis of the difference between addslashes and mysql_escape_string in PHP_php skills

WBOY
Release: 2016-05-16 19:53:41
Original
1522 people have browsed it

This article analyzes the difference between addslashes and mysql_escape_string in PHP with examples. 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 is 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 on this site: "PHP Data Structure and Algorithm Tutorial", "Summary of PHP Operations and Operator Usage", "Summary of PHP network programming skills", "Introduction to PHP basic syntax tutorial", "Summary of PHP office document skills (including word, excel, access, ppt)", "php date and time usage summary", "php object-oriented programming introductory tutorial", "php string (string) usage summary" , "php mysql database operation introductory tutorial" and "php common database operation skills summary"

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

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!