Why sanitizing and escaping are recommended to be done separately
<p>I have read a number of articles about php security, most of them recommend that I only need to sanitize user input when I want to output it, and if I want to just store it in my database, i only need to escape it using PDO.</p>

<p>why it is not wise/good to sanitize and escape the user input all at once and then store it in my database, and when I want to output it I just query it from my database and display it to the user without any sanitization or escaping, because I already did all of that when the user had entered his data in first time?</p>