Hi i am going through the book php anthology 101 tips and tricks and my apache sends an error warning when I process this code:

In particular it does not like this: $dbh->query($sql). I can establish the connection through PDO.

running PHP version 5.1

$dsn = 'mysql:host=localhost;dbname=world;';
$user = 'root';
$password = '';

$country = 'USA';

$dbh = new PDO($dsn, $user, $password);
$sql = 'Select * from city where CountryCode ='.$dbh->quote($country);

foreach ($dbh->query($sql) as $row)
print $row['Name'] . "\t";
print $row['CountryCode'] . "\t";
print $row['Population'] . "\n";

catch (PDOException $e)
echo 'PDO Exception Caught. ';
echo 'Error with the database: <br />';
echo 'SQL Query: ', $sql;
echo 'Error: ' . $e->getMessage();