Errata

Learning PHP, MySQL & JavaScript

Errata for Learning PHP, MySQL & JavaScript, Sixth Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page Line 20 of 4 Chapter 11 example files
https://github.com/RobinNixon/lpmj6/tree/master/11

The github master example files for Chapter 11 have an error on line 20 of each of the following:
04.php
05.php
query.php
fetchrow.php

Line 20 reads: echo 'Category: ' . htmlspecialchars($row['categoryr']) . "<br>";

The string 'categoryr' has an extraneous r at the end and should just read 'category'.

Dave Anderson  Feb 09, 2022 
Page https://learning.oreilly.com/library/view/learning-php-mysql/9781492093817/ch03.html#operators
last paragraph of operators section

Author writes:

$ingredient = $ammonia xor $bleach;

In this example, if either $ammonia or $bleach is TRUE, $ingredient will also be set to TRUE. But if both are TRUE or both are FALSE, $ingredient will be set to FALSE.

This is incorrect.

If both are TRUE, $ingredient will be set to TRUE, because XOR has low precedence as compared to the assignment operator.

The example should be corrected by putting it in parenthesis:

$ingredient = ($ammonia xor $bleach);

Marc Hauser  Apr 20, 2022 
Page Chapter 3
Assignment operators

The author states: "%= assigns a percentage value."
Wouldn't it actually assign the modulus value, since '%' is the modulus operator?

Note from the Author or Editor:
Correct - it assigns the modulus.

Ethan Isenberg  Apr 26, 2022 
Page 37
Using comments

Page 37 states there are 2 styles of comment allowed in PHP, the // form and the /* comment */ form.

The PHP documentation clearly states the shell style single line comments are also allowed -# comment.

Seee https://www.php.net/manual/en/language.basic-syntax.comments.php

So that should really read "3 styles of comment"

Note from the Author or Editor:
You are correct, # is also acceptable to start a comment line.

Dave Anderson  Jan 09, 2022 
Page 107
1st paragraph under 'Delcariing a Class"

class name is described as case-sensitive, wheras it should be case-insensitive

Ron Ford  Feb 07, 2022 
Page 269
Second paragraph

Third line of paragraph under the "Performing Additional Queries" heading.

Reads "There will be two customers in the customers table."

Should read "There will be three customers in the customers table."

See page 205 showing Jack Wilson, Joe Bloggs, and Mary Smith.

Dave Anderson  Feb 10, 2022 
Page 291, 293
First paragraph on 291 and within examples 12-9 and 12-10 on page 293.

The examples that use the "sanitizeString" function fail due to the if statement that tests for "get_magic_quotes_gpc()". This was deprecated in PHP 7.4.0 and would always return false and therefore pointless. With PHP 8.0.0 the get_magic_quotes_gpc() function was totally removed. This results in PHP fatal error. Commenting out the single line 41 in example 12-10 allows the example to work.

// if (get_magic_quotes_gpc()) - deprecated in 7.4.0 and removed in 8.0

Dave Anderson  Feb 09, 2022