Errata

Learning PHP, MySQL & JavaScript

Errata for Learning PHP, MySQL & JavaScript

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
PDF Page Book without pages, only chapters.
22 Introduction to jQuery Mobile

In sentense:

To apply a transition, you use the data-transition attribute within an <a> or &lt;form&gt; tag, like this:

&lt;form&gt; - looks like htmlencoded, and there is no such HTML tag. Should be changed to <form> which is normal HTML tag.

Mikhail Politaev  Mar 16, 2021 
Printed Page Preventing session fixation - page 305
Last Paragraph on the page

The Example 12-9 does not run as described. The instruction at the last paragraph on the page says "Press Reload a few times here, and you should see it count up again from 0."

However, the counter does not go back to 0, but continues to go up.

The explanation to this is as follows: By default (php.ini setup file) the PHP server uses cookies for session management, it ignores the ?PHPSESSID=xxx in the GET part of the URL.

To make the Example 12-9 run correctly it is required to disable cookies. The following function ini_set('session.use_only_cookies', 0); will disable cookies and will let the browser to pass SESSION ID in the URL.

Stan  Jan 11, 2023 
Printed Page 128
Example 6-8

In Example 6-8, the myEach function returns this array:

[$key, current($array), 'key', 'value' => current($array)]


I believe the third element is incorrect and should instead be 'key' => $key so that the returned array would be:

[$key, current($array), 'key' => $key, 'value' => current($array)]


From https://www.php.net/manual/en/function.each.php, the each function...

"Returns the current key and value pair from the array array. This pair is returned in a four-element array, with the keys 0, 1, key, and value. Elements 0 and key contain the key name of the array element, and 1 and value contain the data."

Nate  Oct 20, 2021 
Printed Page 142
Table 7-2

I believe that the in "Example" column of Table 7-2, in the first row, the rightmost cell ("10.285000") should be right-justified (it is currently left-justified) to mesh with the output presented on page 141.

Jeff  Feb 26, 2022 
PDF Page 159
Example 7-16

When running the code in Example 7-16 and uploading whilst not having selected a file, the prompt is: '' is not an accepted image file. This entails that it doesn't skip the if statement that checks if $_FILES isn't empty.

A solution would be to check if "$_FILES['filename']['name']" isn't empty. Modifying the if statement as such would skip over the "if" statement and move onto the else statement, which echoes: "No image has been uploaded".

Titas  Aug 09, 2022 
Printed Page 239
Example 10.4

I fed example 10.3 (included login.php too in it) to XAMPP using Netbeans IDE using below script.
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Project/PHP/PHPProject.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
// login.php
$hn = 'localhost';
$db = 'publications';
$un = 'root';
$pw = 'mysql_bf';
// query-mysqli.php

require_once 'login.php';

$connection = new mysqli($hn,$un,$pw,$db);

if ($connection ->connect_error) die("Fatal Error");

$query = "SELECT * FROM classics";
$result = $connection->query($query);

if(!$result) die("Fatal Error");

$rows = $result->num_rows;

for ($j = 0; $j < $rows; ++$j)
{
$result->data_seek($j);
echo 'Author: '
.htmlspecialchars($result->fetch_assoc()['author']).'<br>';

echo 'Title: '
.htmlspecialchars($result->fetch_assoc()['title']).'<br>';

echo 'Category: '
.htmlspecialchars($result->fetch_assoc()['category']).'<br>';

echo 'Year: '
.htmlspecialchars($result->fetch_assoc()['year']).'<br>';

echo 'isbn: '
.htmlspecialchars($result->fetch_assoc()['isbn']).'<br>';


}

$result->close();
$connection ->close();
?>
</body>
</html>

Result was partial. When I run the same query on Command Prompt it gives a complete output.

[Another issue: XAMPP has to have all files in 'htdocs' whereas Ampps could contain the files in a subdirectory when used with Netbeans].




Anonymous  Feb 02, 2022 
Printed Page 264
it concerns the complete paragraph

The safe method calls get_magic_quotes_gpc() but in PHP8.0 this function is removed and mentioned as not safe. https://www.php.net/manual/en/function.get-magic-quotes-gpc.php

Jorn  Apr 30, 2021 
Printed, Other Digital Version Page 387
example 16-3

Example 16-3. Pages 387-392

The adduser.php program starts always with the php validation errors of the form fields even if there´s nothing submitted yet. The PHP message "sorry, the following errors were found in your form:" always shows:

No Forename was entered
No Surname was entered
No Username was entered
No Password was entered
No Age was entered
No Email was entered


It´s not posible to see the figure 16.5 and test specific field errors in the PHP validation code. JavaScript alert code works fine , but PHP doesn´t show what it should until all fields are filled correctly.

Anonymous  Jul 28, 2020 
Other Digital Version 483
Example 14-9 Code

In the code of Example 14-9, the logical operator "OR" is used instead of "||" which produces a JavaScript error.

I am reading the Amazon Kindle version.

Anonymous  Sep 07, 2020 
Printed Page 669
Example 26-6, iframe tag, src attribute

In the printed Example 26-6, the iframe src attribute is set to 'example26-11.html'. However, 'example26-11.html' does not exist in the printed book. The last paragraph on the page correctly indicates that the iframe loads Example 26-7 in describing the code in Example26-6.

Frank Logosh  Sep 01, 2020