First of all, never have exit into your functions/methods. Functions are made to do or return stuff.
iamjone, that string is echo(ed), if you click the image.
<?php
function alljokes() {
global $pdo;
try {
$result = $pdo->query('SELECT joketext FROM joke');
$row = $result->fetch();
} catch (PDOException $e) {
throw new Exception( $e->getMessage() );
}
return $row;
}
echo 'Here are all jokes:<br />';
try{
echo '<pre>', alljokes(), '</pre>';
} catch(Exception $e) {
echo 'SQL Error '.$e->getMessage();
}
?>