checking username and password PHP : <p>I'm trying to create a php username and password checker but can't get it to work, here is the code:</p>

<pre><code>&lt;?php
$servername = "iphere";
$user = "userhere";
$pass = "passwordhere";
$dbname = "databasehere";

try {
    $username = $_GET['username'];
    $password = $_GET['password'];
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $user, $pass);
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn-&gt;prepare("SELECT username FROM users WHERE username = :name AND password = :password");
    $stmt-&gt;bindParam(':name', $username);
    $stmt-&gt;bindParam(':password', $password);
    $stmt-&gt;execute();
    $result = $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);

    if($username == $result &amp;&amp; $password == $result)
    {
        echo "OK";
    }
    else
    {
        echo "not OK";
    }


}
catch(PDOException $e) {
    echo "Error";
}
$conn = null;
?&gt;
</code></pre>

<p>It doesn't give any error or anything. It just echoes OK and thats it. By the way i use GET for my another project. So i will change it later.</p>
