Unable to connect to the ' . 'database server at this time.

'); } if (!@mysql_select_db('ijdb')) { exit('

Unable to locate the joke ' . 'database at this time.

'); } $jokessql = 'SELECT joke.id, LEFT(joketext, 20), jokedate, name, email FROM joke, author, jokecategory WHERE authorid=author.id AND jokeid=joke.id'; if (isset($_GET['cat'])) { // Category filter specified $cat = $_GET['cat']; $jokessql .= " AND categoryid='$cat'"; // Get category name $catresult = @mysql_query("SELECT name from category WHERE id='$cat'"); if (!$catresult) { exit('

Error retrieving category name from database!
' . 'Error: ' . mysql_error() . '

'); } if (mysql_num_rows($catresult) < 1) { exit('

Couldn\'t find specified category in the database!

'); } $catdetail = mysql_fetch_array($catresult); $catname = htmlspecialchars($catdetail['name']); } else { $catname = 'All'; } ?>

Jokes

'); exit('

Error retrieving jokes from database!
' . 'Error: ' . mysql_error() . '

'); } while ($joke = mysql_fetch_array($jokes)) { $id = $joke['id']; $joketext = $joke['LEFT(joketext, 20)']; // If the joke text is 20 characters long, add "..." to the end of it // to indicate that it is actually longer. strlen() returns string length! if (strlen($joketext) == 20) { $joketext .= "..."; } // Remove any custom tags (even partial ones!) in the joke text. They are not needed in this preview. $joketext = ereg_replace('\\[(B|EB|I|EI|L|L=|L=[-_./a-z0-9!&%#?+,\'=:;@~]+|EL|E)?(]|$)', '', $joketext); // Finally, make it safe to display in an HTML document $joketext = htmlspecialchars($joketext); $author = htmlspecialchars($joke['name']); $email = htmlspecialchars($joke['email']); $jdate = $joke['jokedate']; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } ?>
Joke TextAuthorDate
$joketext$author$jdate

Back to front page