I am learning to work with PHP and have a simple problem.
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();
}
Try print_r($db->errorInfo());
Probably the prepare failed so you can't use it.