am having little problem with SELECT statement in my PHP and MYSQL tutorial....when I connect to my database and I want to use PHP try-catch to SELECT the database content with the code below butI always get a PDOException error message that say "no database selected"


try
{
$sql = 'SELECT booktext FROM book';
$result = $pdo->query($sql);
}
catch (PDOException $e)
{
$error = "error fetching books: " . $e->getMessage();
exit();
}

while ($row = $result->fetch());
{
$jokes[] = $row['booktext'];
}

help me out....