Fatal error: Call to a member function bindParam() [duplicate]

I would check that the $db->prepare() function executed successfully. It will return false if it did not. So you could be trying to call bindParam() on a variable that equals false

http://www.php.net/manual/en/pdo.prepare.php

Also you should put the PDO object declaration in try/catch to be sure it was successful as well, as in the first example on this page:

try {
    $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}

Leave a Comment