I've got a new issue:
I am trying again to connect to my jokes database, this time with a few added things: an author name and e-mail address. The PHP is connecting to my database, but none of my jokes are showing up... Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Our List of Jokes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<head>
<body>
<?php
// Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'new password');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the jokes database
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here are all the jokes in our database:</p>
<blockquote>
<?php
$jokelist = @mysql_query(
'SELECT joketext, name, email
FROM joke, author WHERE authorid=author.id');
if (!$jokelist) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ($joke = mysql_fetch_array($jokelist)) {
$joketext = $joke['joketext'];
$name = $joke['name'];
$email = $joke['email'];
// Display the joke with author information
echo "<p>$joketext<br />" .
"(by <a href='mailto:$email'>$name</a>)</p>";
}
?>
</blockquote>
</body>
</html>