How does PHP + MySQL store HTML code into a database?
What to pay attention to? What type of database fields are used? What does PHP do with HTML code?
Hello World';//Database Tablepart_name | Html_codehello |?? ?>
Reply to discussion (solution)
The field type is stored directly on the text type.
Tinytext a maximum length of 255 (2^8-1) characters.
Text has a maximum length of 65535 (2^16-1) characters.
Mediumtext a maximum length of 16777215 (2^24-1) characters.
Longtext Maximum length is 4294967295 (2^32-1) characters
See the choice of circumstances
Upstairs two positive solutions,
Add:
1, pay attention to the string of modern deposit database.
2, the field must be a string type, including Text,varchar (must be sufficient length) and so on.
3. When you read from the database, remember to use the Htmlspecialchars function for processing. Otherwise, the received string will be HTML code.