MySQL Escape character special characters
RT, usually php+mysql single quotes, "\" symbol insertion generally using addslashes () mode
If, now insert $varstr = Test ' \, the problem is as follows:
1. With addslashes (), insert after insert in MySQL storage format is test ' \, or test\ ' \ \?
3.select out, Echo $varstr; is the test ' \, or test\ ' \ \?
2.SELELCT do I need to add addslashes () when I query the variable string as a condition?
MySQL on the escape character problem, very headache, I hope the experts come out to the next, thanks!
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 This is another way of escaping, I'm talking about the addslashes way.
In addition to the above 3 questions, there are still a lot of details that need attention, often easily confused.
such as: echo "\\\\\\\\\" stripslashes handle all kinds of strange phenomenon.
Ask the experts to comb.
The storage format in MySQL is Test ' \
echo $varstr; display is test ' \
SELELCT do I need to add addslashes () when querying with this variable string?
To
Thanks, upstairs.