Errata

Learning PHP, MySQL, JavaScript, CSS & HTML5

Errata for Learning PHP, MySQL, JavaScript, CSS & HTML5

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
Printed
Page 15
Chapter 2

Recently Zend has chosen to stop offering the free edition of its server software, as recommended in the book. It has been replaced with a Developer Edition that starts from $99, and goes up into the hundreds for a yearly license.

However, being learners, readers of this book need a free option to practice on before choosing whether to opt for any paid environments. Therefore Chapter 2 has now been rewritten to detail installing the free alternative suite, XAMPP. It provides all the same features of Zend, including the Apache web server, MySQL, and PHPMyAdmin, and is available for PC, Mac and Linux from:

http://apachefriends.org

You can read and download a free updated PDF of Chapter 2 at the following URL:

http://lpmj.net/3rdedition/newc2.pdf

A copy of this file is also included in the downloadable archive of example files at:

http://lpmj.net

Robin Nixon
Robin Nixon
 
Jul 08, 2014 
PDF
Page 76
Example 4-4

Running Example 4-4 on Xampp outputs this error::
Notice: Undefined variable: day_number in D:\xampp\htdocs\Learning\example4-4.php on line 2

Note from the Author or Editor:
Example 4-4 in Edition 3 should be as follows:

$day_number = 340;
$days_to_new_year = 366 - $day_number;

if ($days_to_new_year < 30)
{
echo "Not long now till new year";
}

Mohammad Fayed  Oct 20, 2014 
Printed
Page 203
top paragraph

The second query asks for rows that contain both 'old' and 'shop'. It should be noted that 'old' is a FULLTEXT stopword too (like 'and'). So the example as such works, but I don't think the example was meant to include a stopword and a non-stopword.

Best regards,
Bob Dijck

Note from the Author or Editor:
Thanks - this is an interesting catch. As you say, the example works anyway, but in this instance it was not ideal to include a stopword (which was used inadvertently). But seeing as the example works fine I don't recommend readers need to concern themselves about updating anything. However, the next edition of the book will be updated to search for 'curiosity shop' instead of 'old shop'.

Anonymous  Aug 08, 2014 
Printed
Page 205
OS X Users

The text says to go to http://localhost:10081/phpmyadmin/ but this only yields a 404 error. PHPMyAdmin was never previously shown in the preceding chapters! So how are users supposed to get to it if it's not installed? I'm trying to fix this issue now.

Note from the Author or Editor:
Since Zend is now no-longer free I will answer your question by suggesting you download the free XAMPP suite, which comes with PHPMyAdmin already installed.

Actually this software has come on in leaps and bounds, and I'm beginning to think it is better than Zend for the purposes of teaching PHP. So please go ahead and install it from http://apachefriends.org (you will probably have to uninstall Zend first) and you should be set to go.

Hopefully you'll have no further issues.

Ian Schulze  Jun 10, 2014 
Printed
Page 269
Chapter 11

Chapter 11 covers the use of the mysqli PHP class, which is fine in the sense that at least it is not using the deprecated mysql class, however, I believe it would be a vast improvement to replace this chapter by covering the PDO class: http://php.net/manual/en/book.pdo.php

Chapter 10 should not even mention the mysql class, as it is deprecated. Perhaps you could introduce the mysqli class there, then cover PDO in Chapter 11 as the improved/preferred connection method.

I hope you will take these suggestions into consideration, and thank you in advance for your time.

Note from the Author or Editor:
Thanks for your feedback. The introduction to mysqli was to help new programmers deal with legacy code. However, in the forthcoming edition all discussion of mysql will be dropped in favor of only mysqli.

You make an interesting point regarding PDO. It does have benefits in that it supports a wide range of databases (not just MySQL). However, in the case of MySQL. it is actually coded as a wrapper for mysqli, and runs up to 10% more slowly on large databases than native mysqli.

Nevertheless, I have made a note to add a few paragraphs in a future edition explaining how to use PDO in cases where database portability will be a requirement.

Anonymous  Jul 23, 2014 
Printed
Page 271
Example 11-4

The following line in Example 11-4 is missing a semicolon at the end:

if ($connection->connect_error) die($connection->connect_error)

Note from the Author or Editor:
In the book the semicolon is indeed missing from the end of this line, in both Examples 11-4 and 11-2, but they are correctly in place in the examples archive that is downloadable from http://lpmj.net

Anonymous  Oct 26, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 276
2/3 of the way down

Unfortunately the explanation of using placeholders in prepared statements with the mysqli extension somehow slipped through the net during production of this edition.

Placeholders are explained in Chapter 10 which explains the old mysql extension, for when you have to maintain legacy code. But it's far better to update such code and so you need to know how to do that.

The revised Chapter 11 explains all you need to know and will be in the next edition of the book. However it is also available right now as part of a free PDF of the whole of the new Chapter 11, and may be downloaded from here:

http://lpmj.net/3rdedition/newc11.pdf.

Robin Nixon
Robin Nixon
 
Jun 21, 2014 
Printed
Page 292
Example 12-9

The order of htmlentities() and strip_tags() needs to be reversed. By first changing angle brackets to entities there are no identifiable "tags" left to strip,

This handy function is included on other pages as well.

(I do hope you have not used the existing version in your "production" code!)

But thank you, I am adding this function to several of my systems. I like the book; although I am now generally using SQLite accessed by PDO. (Hint! for next book.)

Note from the Author or Editor:
Thanks and well spotted. The order of these makes a difference as you say. The example files have been amended accordingly, and the manuscript to the forthcoming edition has been changed too. And, yes, PDO is on the list of things for consideration.

Jeff Hennick  Jul 10, 2014 
Printed
Page 399
bottom: value="surname">

(Page 399 and 400)
The value values in all these input tags need to have a $

For example:
value="surname">
needs to be
value="$surname">

Without the $ the text surname will appear; with the $, the PHP value is substituted as indicated at the bottom of page 401 and top of 402. Page 402's second line has it right.

Note from the Author or Editor:
Thanks for the feedback. These items do require the $ to make the contents of the variables display. This is corrected in the downloadable files at lpmj.net.

Jeff Hennick  Jul 18, 2014