What happens when HTML tags are inserted into mysql is escaped

Source: Internet
Author: User
Keywords Php mysql html
The HTML code of a picture is escaped when it is inserted into MySQL, as follows

What causes this escape?
How to avoid this situation.
When this happens, use Html_entity_decode () to turn the following, or the HTML will be output as a string.

Reply content:

The HTML code of a picture is escaped when it is inserted into MySQL, as follows

What causes this escape?
How to avoid this situation.
When this happens, use Html_entity_decode () to turn the following, or the HTML will be output as a string.

It's not MySQL, let's find out why. It may be that the frame you use or the data submitted is escaped when filtered, and even the submitted data is already escaped, and it's not a big deal to follow.

If the general practice is to prevent XSS attacks such as non-escaped storage, such as database fields are stored

123

However, to prevent XSS attacks, HTML code escapes are performed at the time of Display Htmlspecialchars ()

So you have to first confirm that the PHP.ini method has no magic_quotes_gpc=on such configuration, if there is off, if this is already off
Then you have to follow the steps in the program to find escape code modifications

Inside what, you're not escaping, it's just a character entity.

So your problem is pseudo-proposition, MySQL will not take the initiative to help you do character entity operation, PHP may actively help you to escape operation (PHP.ini set Magic_quotes_gpc=on)

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.