I got this Fatal error: Call to a member function bindValue() on a non-object in c:\wamp\www\addjoke\index.php on line 51.
What does it mean and how to fix it? Below is the code teached by book, after i execute it, the browser gave me fatal error on bindValue.
Any opinion will be appreciate.

if(isset($_POST['joketext']))
{
try
{
$sql='INSERT INTO joke SET
joketext = :joketext,
jokedate = CURDATE()';
$S=$pdo->prepare($sql);
$s->bindValue(':joketext',$_POST['joketext']);
$s->execute();
}
catch(PDOException $e)
{
$error='Error adding submitted joke: ' . $e->getMessage();
include 'error.html.php';
exit();
}
header ('Location: .');
exit();
}