<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Code injection - Page 21 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Code_injection&amp;p=20">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Code_injection&amp;p=22">3.Next</a>
</p>
<p><code>hunter2</code> might or might not be the correct password, the expression <code>'1'='1'</code> is always true and the database will return all rows in the <code>UserList</code> table -- thus allowing the attacker to log in even if they don't have the correct password.</p>

<p>The technique may be extended to allow the attacker to execute multiple statements. For example, if the attacker provided the password <code>hunter2'; DROP TABLE UserList; --</code>, the resulting query would be:</p>

<p><syntaxhighlight lang="sql">SELECT UserList.UsernameFROM UserListWHERE UserList.Username = 'alice'AND UserList.Password = 'hunter2'; DROP TABLE UserList; --'</syntaxhighlight></p><p>
<a accesskey="1" href="page.php?w=Code_injection&amp;p=20">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Code_injection&amp;p=22">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
