0
string query = "SELECT * 
                FROM users 
                WHERE username = "'" + username + "' 
                      AND password = '" + password + "'"; 

Since this query is constructed by concatenating an input string directly from the user, the query behaves correctly only if password does not contain a single-quote character. If the user enters

__"
joe
"
as the username and
"
example' OR 
 'a'='a
as the password, the resulting query 
becomes__

I want to know what the single quote character means

PM 77-1
  • 12,933
  • 21
  • 68
  • 111

0 Answers0