Uncategorized Php Example Sql Injection - Sql injection usually occurs when you ask a user for input, like their username/userid, and instead of a name/id, the user gives you an sql statement that you will unknowingly run on your database. An sql injection is a technique that attackers apply to insert sql query into input fields to then be processed by the underlying sql database.