I have the following PDO query set up:
$CHECK_MATCH = $DBH->query("
SELECT COUNT(*) as matches FROM users WHERE
username = :username AND password = :password
");
$CHECK_MATCH->bindParam(':username', $username);
$CHECK_MATCH->bindParam(':password', $password);
However, I recieve an error saying:
Fatal error: Call to a member function bindParam() on a non-object
Why doesn't this work?
How would I retrieve the required values from the statement if i used prepare instead of query?
->queryis meant for direct execution, not statement preparation.$DBH->prepareinstead of$DBH->query->queryso that I could grab values from the results. How would I get those values using a prepared statement?$row = $CHECK_MATCH->fetch(PDO::FETCH_OBJ)