For mysql escape character insertion, query, and display problems, obtain special characters for mysql escape characters.
RT, which is a single quotation mark in php + mysql. the "\" symbol is inserted in the addslashes () mode.
If $ varstr = test' \ is inserted, the problem is as follows:
1. with addslashes (), after insert is inserted, the storage format in mysql is test' \, or test \'\\?
3. after the select statement is selected, echo $ varstr; is it test' \ or test \'\\?
2. do I need to add addslashes () when selelct queries with this variable string as the condition ()?
Mysql has a headache about escape characters. I hope experts can give me some help. thank you!
Reply to discussion (solution)
Http://php.net/manual/zh/function.mysql-real-escape-string.php
Http://php.net/manual/zh/function.mysql-real-escape-string.php
Ls is another escape method. I am talking about the addslashes method.
In addition to the above three questions, there are many details that need attention and are often confusing ..
For example, echo "\\\\\\\\\" stripslashes handles various strange phenomena.
Ask experts to sort the information.
The storage format in mysql is test '\
Echo $ varstr; display as test '\
Do I need to add addslashes () when selelct queries with this variable string as the condition ()?
Yes
Thank you ..