Pop quiz: What is the singular cause of SQL injection, XSS, and stack overflows that causes a security vulnerability?<p>...<p>The answer is: Data being treated as an instruction.<p>Solution: Separate them so that data can never be interpreted as an instruction!<p>In SQLi, this solution is to use parameterized queries. You send the query in one packet, then the parameters in a second one. SQLi is thus prevented.<p>(Not that SQLi is the only vulnerability possible.)