Debugging why a mysql query failed

True the database doesn’t care, but the concept naively assumes the data will always be used in an HTML output context so I stand by what I said. htmlspecialchars is an OUTPUT function ONLY for use in an HTML context which you don’t know what that will be UNTIL you output it. You don’t change data when you save it.

this function is sufficient to prepare input for inclusion in most contexts of an HTML document

https://www.php.net/manual/en/function.htmlspecialchars.php

2 Likes