 <p>Try to change:</p> <pre><code>$stmt-&gt;bindParam(':username', $username, ':password', $password); </code></pre> <p>to:</p> <pre><code>$sth-&gt;bindParam(':username', $username, PDO::PARAM_STR); $sth-&gt;bindParam(':password', $password, PDO::PARAM_STR); </code></pre> <p>I have tried again to edit your code, you don't need to use global variable, because you instantiate the PDO class directly and use it on the fly. </p> <pre><code>try { $pdo = new PDO('mysql:host=localhost;dbname=redgrace_staxapp', 'root', ''); $pdo-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch (PDOException $e) { die('MySQL connection fail! ' . $e-&gt;getMessage()); } function delete_user($username, $password) { if (username_exists($username)) return TRUE; $query = "DELETE FROM users WHERE username = :username and password = :password"; $stmt = $pdo-&gt;prepare($query); $stmt-&gt;bindParam(':username', $username, PDO::PARAM_STR); $stmt-&gt;bindParam(':password', $password, PDO::PARAM_STR); $stmt-&gt;execute(); } </code></pre>