I have a user input field which will be stored into a 'tinytext' field in a MySQL database; pretty standard stuff. I am wondering if there is some sort of standard or best-practice to adhere to when it comes to escaping html special characters using the php function htmlentities()
?
Should I use htmlentities()
before I store the data in the database or should I run the function on the data ever time it is output from the website?