SQL injection attacks allow attackers to execute arbitrary queries or commands against a database. Developers introduce the vulnerabilities into their code when they concatenate or substitute user input into the elements of a SQL query. In the following Python example, the program will accept any input as the "user_id" variable (returned as a part of login_data) and tack it onto the end of a string that is subsequently executed as a sql query:
login_data = web.input()
query_string = "SELECT * FROM USERS WHERE ID = '%s'" %login_data.user_idcursor.execute(query_string)