I was studying the code line by line for jokes.php on pages 77-79 of your PHP/MySQL book.

I notice in one place you made the query into a variable $sql. Later on you did the query straight without a variable. Is there a reason you made the query a variable the first time?

Query is a variable:

Code:
  if (isset($_POST['joketext'])) {
    $joketext = $_POST['joketext'];
    $sql = "INSERT INTO joke SET
        joketext='$joketext',
        jokedate=CURDATE()";
    if (@mysql_query($sql)) {
      echo '<p>Your joke has been added.</p>';
Query is not a variable:

Code:
 $result = @mysql_query('SELECT joketext FROM joke');
  if (!$result) {
    exit('<p>Error performing query: ' .
        mysql_error() . '</p>');
  }
Thanks!
Steve