
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.
| Chapter | Page # | Description | Date Added |
|---|---|---|---|
| 1: Advanced PHP Techniques | 10 | The “tasks” table definition as is won’t work properly. When the date_completed column is updated, it also updates the date_added. This occurs because MySQL updates the first TIMESTAMP column in the table when that record is inserted or updated. The solution would be to define both date_added and date_completed as DATETIME, then change the INSERT queries to set the date_added column to NOW(). | August 30, 2007 |
| 1: Advanced PHP Techniques | 15 | On the second line of code under Step 9, the word “its” should not be there. The corresponding script is correct. | April 1, 2007 |
| 1: Advanced PHP Techniques | 16 | In Step 12, the fieldset should be closed before the form is closed. This also applies to lines 79 and 80 of Script 1.2 and lines 69 and 70 of Script 1.6. | April 1, 2007 |
| 1: Advanced PHP Techniques | 39 | In the first step, add_task.php should refer to Script 1.2, not Script 1.1. | |
| 2: Developing Web Applications | 76 | The comment on line 15 of Script 2.7 should state that the cache interval is 6 hours, not 24. | May 19, 2008 |
| 3: Advanced Database Concepts | 96 | In the very last sentence, it should say One source of… (“One” instead of “Once”). | May 21, 2007 |
| 3: Advanced Database Concepts | 97 | In creating the zip_codes table, the longitude field should be defined as DOUBLE(9,6) instead of DOUBLE(8,6) to accommodate longitudes, like Hawaii and Washington state, that have 3 digits in front of the decimal point. | July 10, 2007 |
| 3: Advanced Database Concepts | 105 | If a database connection cannot be made on line 31, the error message (within the die()) should have a closing P tag. This also applies to Step 3 on page 106. | November 5, 2008 |
| 3: Advanced Database Concepts | 105 | The query ending on line 47 of Script 3.3 should have the final closing parentheses after 69.09. This also applies to the code in Step 6 on page 107. | October 26, 2009 |
| 3: Advanced Database Concepts | 111 | Midway down the page, it should say RETURN data, not RETURNS. | January 27, 2012 |
| 3: Advanced Database Concepts | 115 | The query in Step 10 has an extra – before 95.276050. | July 9, 2008 |
| 4: Security Techniques | 125 | The function referenced in item 10 should be mysqli_real_escape_string(). | May 19, 2008 |
| 4: Security Techniques | 139 | The comment on line 47 of Script 4.2 should read Strip tags and encode quotes:. | August 30, 2007 |
| 4: Security Techniques | 147 | The $auth->start() line needs to be before the opening HTML (line 42) if you’re not using output buffering. | November 5, 2008 |
| 4: Security Techniques | 159 | The first line of code is missing an “i” in “deinit”. It should read mcrypt_generic_deinit($m);. | January 26, 2008 |
| 5: E-Commerce Techniques | 172 | The first entry in Tables 5.4, 5.5, and 5.6 should be of type TINYINT. | July 9, 2008 |
| 5: E-commerce Techniques | 201 | Line 60 of Script 5.5 should be if (mysqli_num_rows($r) >= 1) {. This change also applies to the last line of code under Step 7 on page 203. | May 14, 2007 |
| 5: E-Commerce Techniques | 203 | In the code under Step 8, the echo statement should have …gw_id=$gw_id…. The corresponding script is correct. | July 9, 2008 |
| 5: E-Commerce Techniques | 207 | Line 57 of Script 5.6 should be if (mysqli_num_rows($r) >= 1) { This also applies to Step 6 on page 209. | November 5, 2008 |
| 5: E-Commerce Techniques | 209 | On line 5 of the code under Step 6, the variable should be $gw_id, not $gwid. The right code is USING (size_id) WHERE gw_id=$gw_id. The code in the corresponding script is correct. | January 26, 2008 |
| 5: E-Commerce Techniques | 216 | On line 148 of Script 5.7, the bold tag isn’t properly closed after “Total:”. | October 25, 2008 |
| 6: Basic Object-Oriented Programming | 238 | On line 20 of Script 6.1, and in the code under step 5, the Dutch version should be Hallo, wereld!. This also affects Figure 6.1 on page 243. | May 14, 2007 |
| 6: Basic Object-Oriented Programming | 250 | In the last Tip, it should say that both rectangles have the new dimensions as $r1 and $r2 refer to the same object. In PHP 4, $r1 and $r2 would be two different objects. | July 10, 2007 |
| 6: Basic Object-Oriented Programming | 250 | The third line of code in the second tip should read return ($this->width * $this->width); | November 8, 2007 |
| 7: Advanced Object-Oriented Programming | 264 | In the last sentence of the third paragraph, “reusability” is misspelled. | July 9, 2008 |
| 7: Advanced Object-Oriented Programming | 265 | In Figure 7.4, ‘attribute4′ of GrandchildClass should not be grayed out as it does not appear in ChildClass. | April 1, 2007 |
| 7: Advanced Object-Oriented Programming | 267 | The title value in the code for Step 1 (right-hand column) should be “Pets”, not “Rectangle”. The corresponding script is correct. | July 9, 2008 |
| 7: Advanced Object-Oriented Programming | 283 | Line 78 of Script 7.4 should say …modify $parent->protected…. This change also applies to the fifth line of code under Step 8 on page 286 and to Figure 7.14 on that same page. | May 14, 2007 |
| 7: Advanced Object-Oriented Programming | 292 | Line 112 of Script 7.5 should be unset($dog, $cat, $pet); | April 2, 2011 |
| 8: Real-World Object-Oriented Programming | 321 | The message on line 42 should say “The file is not writable.” The corresponding code in Step 4 on page 324 is correct. | October 25, 2008 |
| 8: Real-World Object-Oriented Programming | 332 | On line 149 of Script 8.4, the closing bold tag is missing its slash. This also applies to the code in Step 12 on page 339. | January 19, 2009 |
| 8: Real-World Object-Oriented Programming | 340 | On line 7 of the first paragraph, the word “uses” should be “use”. | May 24, 2009 |
| 9: Networking With PHP | 361 | The last line under Step 9 should refer to the check_url() function (singular). | July 9, 2008 |
| 9: Networking With PHP | 367 | In the second tip, it should say …the host name associated with… (without the “of”). | July 10, 2007 |
| 11: PHP’s Command-Line Interface | 435 | The first line of code under Step 3 should refer to $_SERVER['argv'][1]. The corresponding script is correct. | July 9, 2008 |
| 13: Ajax | 501 | In Script 13.4, the closing FORM and FIELDSET tags should be reversed on lines 33 and 34. This also affects Steps 4 and 5 on page 503. | April 15, 2008 |
| 14: XML and PHP | 549 | In the eighth line in the left-hand column, it should refer to the xml_parser_create() function (as in the following line of code). | April 15, 2008 |

Hi Larry,
I think I found an error on page 292, line 112 in your book php-5-advanced-visual-quickpro-guide-2nd-edition
Should it be unsetting $cat and not $bucky?
I couldn’t find it in the errata so thought I would bring it to your attention.
Kind Regards,
John.
Thanks, John, you are correct. I’ve added it to the list!
Hi Larry,
I think i’ve found an error in the bonus material.
Page 40 of creating images.
Should “Two create a circle, you can use imageelipse()”
really be “To create a circle, you can use imageelipse()”
Didn’t know if you included errata from bonues materials or not.
Thanks
Jonathon
Hello Jonathon. Thanks for catching that. I don’t include errata from the bonus material but there’s no reason why that error can’t be mentioned in these comments.
I think I have found an error, but I just want to be sure.
On page 257 in the actual Script 6.7, on lines 48-49, the code is listed as:
echo ‘Calling the function…’;
demo();
For me, I cannot simply call the demo() function without referencing the object. Thus, I must employ the following syntax:
$o->demo();
Otherwise, I get the following error:
Fatal error: Call to undefined function demo()
If I use the syntax of $o->demo(), the script works.
Furthermore, this error also exists on page 258, step 8, which is the explanatory text corresponding to the particular code.
Best,
Al
Hello Al,
I suspect you defined the function as part of the Demo class, in which case it’d be a method of that object and must be called using the object. In the actual code, demo() is defined as a standalone function.
As Homer Simpson would say, “D’oh!”.
That was a simple mistake.
Hi Larry, making my way through the book and wanted to point on that in chapter 3 on db sessions you can also call your session close function from the destroyer function to solve that problem. At least, according to the manual it should work: http://php.net/manual/en/function.session-set-save-handler.php
Cheers!
Thanks, Matt!
I’ll be greedy and make three points:
1. On page 111, I think you confused the RETURN and RETURNS keywords?…
“Stored functions must contain a RETURNS clause, indicating the type of value returned by the function. Functions return scalar (single) values, like a number or a string.
To do so, use
RETURNS data
within the function’s code body. The type of the data returned must match the type indicated in the function’s initial definition line.”
I think you meant to say:
“Stored functions must contain a RETURN clause, indicating the value returned by the function. Functions return scalar (single) values, like a number or a string.
To do so, use
RETURN data
within the function’s code body. The type of the data returned must match the type indicated in the function’s initial definition line.”
2. If anyone is interested, I have a couple of links to UK postcode latitude/longtitude data, which could be used instead of the US zipcode for chapter 3 – Larry, if you want to add them somewhere here (or even in any future revision of the book!), just contact me!
3. The table for the errata is a bit confusing… could you either put cell borders around it, or alternatively have all the cells aligned to the top of the cells, so you get something like
1: Advanced PHP Techniques | 10 | The “tasks” table definition as is won’t work | August 30, 2007
| | properly. When the date_completed column is |
Regards,
Steve
Thanks for catching that error. I’ve added it to the list.
Hi Larry, as you can guess, I’m still going through the book!
On page 119:
- line 84 of script 3.4 should have have a tab character inserted, so that it aligns with the other TD tags:
echo “\t<td> </td>\n”;
- this also affects step 10 on page 122, and the output in Figure 3.39 (also on page 122).
Regards,
Steve