The example code is incorrect. The line that reads:
$err = $dbh->prepare('SELECT skull FROM bones');
Will set the value of $err to be boolean FALSE.
So, to get a useful error dump change this line:
print_r($err->errorInfo());
to:
print_r($dbh->errorInfo());