Skip to content


“PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” (4th Edition) Errata

Unfortunately, despite the best efforts of myself, the technical editor, the copy editor, the line editor, the proofreader, and despite the multiple revisions, errors still occur. This page lists all the errors found in the book since it went to print.

Note: errors are corrected in subsequent printings and therefore your particular copy may not contain all of the following. You may also be experiencing problems not caused by a mistake in the book. If so, you may find the solution to your problem by using the book’s corresponding forum. Significant changes in the technology will be addressed there and you can also find problems and solutions encountered by other readers.

Known Errors in the Book:

Click on a column heading to sort the table by that column.

ChapterPage #DescriptionDate Added
Chapter 3: Creating Dynamic Web Sites107The second line of code under Step 3, and line 30 of Script 3.10 on page 106, should use multiplication, not division: $dollars = $gallons * $ppg;.October 9, 2011
Chapter 6: Database Design193Step 6 should suggest that you repeat Steps 3-5.April 5, 2012
Chapter 7: Advanced SQL and MySQL205The first sentence of the third paragraph should say “This join is selecting two columns…”.October 9, 2011
Chapter 9: Using PHP with MySQL277The code in Step 8, which assigns the query to the $q variable is missing its terminating double quotation mark. The corresponding code in Script 9.3 is correct.February 16, 2012
Chapter 10: Common Programming Techniques320In the first paragraph, it should say “the first ten records—0 through 9—should be retrieved”.February 16, 2012
Chapter 12: Cookies and Sessions389On line 19 of Script 12.8, the opening [ is missing after $data. The corresponding code in Step 2 is correct.March 14, 2012
Chapter 13: Security Methods405On line 58 of Script 13.1, the $scrubbed array should be reset instead of $_POST, as this new array is what the form will use.May 1, 2012
Chapter 18: Example—User Registration563At the end of Script 18.2, the phrase "paste code here" should not be there. Ugh.December 8, 2011
Chapter 18: Example—User Registration586The code in Step 2 should refer to $_GET['x'] not $trimmed['email'] (that’s what I get for copying and pasting). The code in the corresponding script is correct.March 3, 2012
Chapter 18: Example—User Registration598Figure E is incorrect.January 8, 2012
Chapter 19: Example—E-Commerce621On line 138 of Script 19.2, the two references to $_POST['existing'] should be to $_POST['artist']. This also applies to the code in Step 15 on page 627.December 8, 2011

24 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Craig Lynas says

    On P. 205 it says “This join is selecting three columns from the messages table”, but isn’t it only selecting two? message_id and subject?

    • Larry says

      Oops! Yes, you’re right. Thanks for pointing that out!

  2. Jack Peters says

    On page 106, in the calculate_trip_cost function, the calculation on line 30 is:
    $dollars = $gallons/$ppg;
    I think it should be:
    $dollars = $gallons * $ppg;

    • Rob Maxwell says

      Jack (Peters),

      You’re right. They should add this to the “Known Errors”.

      • Rob Maxwell says

        I guess the same error also appears a little later, after the code block…

        Larry lists step 3 as:

        $gallons = $miles/$mpg;
        $dollars = $gallons/$ppg; <– Again, should read "$dollars = $gallons * $ppg";
        return number_format($dollars, 2);
        } // End of calculate_trip_cost( ) function.

        (Wish I could give a page # for everyone to reference. I have the Kindle version and the only reference I have is "17% Location 3748 of 22878".)

        :)

      • Larry says

        Sorry about that. I’ve added it.

  3. Bill Dossett says

    I believe there is an error on page 403, top of the left column where the mail function is listed. The comma shown between the left square bracket and the word as ( [,header ]) is misplaced and should be after the word body. … body, [ header ]

    • Larry says

      Thanks for the suggestion, but that’s not an error. That syntax is saying that the header is optional, which is what the square brackets indicate. But, if the header is present, it must be preceded by a comma. No header, no comma. Hence, the comma goes within the square bracket, too.

  4. Nezael Zake says

    I think I found more errors.

    Page #563. At the end of the scrtip line 38, you have “paste code here”. I don’t think that should be there.
    Also,
    Page #621. On script line 138. You have 2 instances of if (isset ($_POST['existing'] …however ‘existing’ should rename to ‘artists’ since that is what you are calling the pull-down.

    Thank you.

    • Nezael Zake says

      Sorry about my typos, did not proof read before posting.

      • Larry says

        No problem. I did proof read my book (many times over), and I still had mistakes!

  5. Steve E says

    On page 598 (chapter 18), screen E is incorrect – it shows the login form rather than the reset password form,!

  6. Nezael Zake says

    Hello Larry,

    Are you going to add these errors to you column table above?

    Thank you.

  7. HartleySan says

    I think I noticed a few errors. Larry, please confirm:

    Page 64: “…$_POST['interests'][0] storing the value of the first checked box (e.g., Movies)…”
    According to the HTML above this excerpt, $_POST['interests'][0] should point to Music, [1] to Movies, etc.

    Page 277: For step 8, the string being assigned to $q is missing an end quote.

    Page 284: Not necessarily an error, but for the first two tips, I think it’s confusing if you don’t provide the argument $r for both the mysqli_fetch_row() and mysqli_fetch_assoc() functions.

    Page 320: “Upon initially calling the script, the first ten records–0 through 10–should be retrieved…”
    Shouldn’t this be “0 through 9″?

    Thanks for your time, Larry.

    • Larry says

      Thanks, HartleySan. The first thing you mentioned isn’t an error, though. $_POST['interests'][0] will store the first CHECKED box, regardless of what is actually the first box. I’ve added the other two errors above.

  8. Chris Palmer says

    On p586, step 2, you have
    if (isset($_GET['x'], $_GET['y']) && filter_var($trimmed['email'], FILTER_VALIDATE_EMAIL)…
    In the script box on the same page you have (line 9)
    if (isset($_GET['x'], $_GET['y']) && filter_var($_GET['x'], FILTER_VALIDATE_EMAIL)…

  9. Nezael Zake says

    Hello Larry,
    On page 389. Only on the script part of the code on line 19 there is a bracket missing.
    You have: $_SESSION['user_id'] = $data’user_id’];
    It should be: $_SESSION['user_id'] = $data['user_id'];

    Thank you.

  10. Krystal Balduc says

    Hi Larry,

    Should page 193 step 6 read “Repeat Steps 3 through 5 to populate the database” rather than instructing to repeat Steps 1-3?

    Cheers, Krystal

  11. Chris Willis says

    Hi Larry,

    I think I’ve spotted a small oversight on page 405. You change the “sticky form” code on each input of the form to use the $scrubbed array, without changing the code that clears the array if the email is sent successfully.

    I think lines 57 and 58 of script 13.1 should be as follows (although I’m not entirely certain if unset is the best thing to use here?).

    // Clear $scrubbed array (so the form isn’t sticky)
    unset($scrubbed);

    P.s. the book’s proving to be a great help, thanks a lot

    • Larry says

      Good eye! Thanks for catching that, Chris. And thanks for the nice words!

If you need quick assistance with a question or problem related to one of my books, please use the support forums instead.

Some HTML is OK

or, reply to this post via trackback.