Quick question, is it a better idea to call htmlentities()
(or htmlspecialchars()
) before or after inserting data into the database?
Before: The new longer string will cause me to have to change the database to hold longer values in the field. (maxlength="800"
could change to a 804 char string)
After: This will require a lot more server processing, and hundreds of calls to htmlspecialchars()
could be made on every page load or AJAX load.
SOOO. Will converting when results are retrieved slow my code significantly? Should I change the DB?