“PHP for the World Wide Web: Visual QuickStart Guide” 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.

Chapter Page # Description Date Added
Introduction 0 On page xvii, Chapter 14, Debugging is inadvertently referred to as Chapter 15, Debugging. July 10, 2001
1: Getting Started 2 The second Tip should begin (change in italics) You can also check with your ISP to see. June 10, 2001
1: Getting Started 8 It states that printf() would be discussed in Chapter 13. It is actually discussed much earlier in the book–in Chapter 4, Using Numbers (pages 43-44). February 3, 2002
2: Variables 22 In the last full paragraph, curly quotes are used instead of straight quotes. February 9, 2003
2: Variables 24 Chapter 7, “Using Arrays”, is inadvertently referred to as Chapter 6. January 1, 2004
3: HTML Forms and PHP 32 Figure 3.2 does not end with a closing HTML tag. September 24, 2003
3: HTML Forms and PHP 33 Scripts 3.4, 3.5, and 3.6 are missing the opening and closing parentheses in the print() statements. While this is technically acceptable, it does break with the conventions of the book.
3: HTML Forms and PHP 33 In Script 3.4, Script 3.5 and Script 3.6 (pages 33, 35, and 37), the closing </HEAD> is missing. The downloadable versions of the scripts have been updated accordingly.
3: HTML Forms and PHP 33 Script 3.4 and many others in the book require that register_globals be turned on. For more information, see this posting. May 1, 2003
4: Using Numbers 45 In the last Tip, the code should read $Number–;.
4: Using Numbers 45 The last line of the first paragraph should read use “++” or “–” accordingly (the two minus signs were fused by the printer). July 10, 2001
4: Using Numbers 45 The line change line 10 of script 4.3 to read $tax++; should read change line 11…. December 31, 2001
4: Using Numbers 45 In Script 4.3, line 6 is missing the inital opening bracket. The line should be
<?php
March 25, 2002
4: Using Numbers 48 It should be explained that the round() function can only take a second argument to round to a particular decimal point in PHP 4. Line 14 of Script 4.5 will cause an error in earlier versions of PHP.
5: Using Strings 52 Script 5.1 is missing the opening and closing parentheses in the print() statements. While this is technically acceptable, it does break with the conventions of the book.
5: Using Strings 52 The closing </HEAD> tags in Script 5.1 through Script 5.7 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
5: Using Strings 54 The first line of code should end with a semi-colon and not a period. It should read:
$NewString = $aString . $bString;
May 25, 2001
5: Using Strings 57 On page 57, the caption of Figure 5.14 should conclude with into its ASCII equivalent, %27. July 10, 2001
5: Using Strings 63 Towards the bottom of the page, the text inadvertenly says
$StringLength = strelen($String);
whereas it should say
$StringLength = strlen($String);
strlen is misspelled.
5: Using Strings 64 The caption to Script 5.7 should end All in 16 lines!. May 25, 2001
5: Using Strings 64 The paragraph starting md5() is similar is use, should say is similar in use. That sentence also ends with an extraneous period. August 21, 2001
6: Control Structures 69 The last sentence begins In order words… but it should read In other words… (naturally). August 21, 2001
6: Control Structures 71 In the first paragraph, the symbol for decrementing a number should read as two separate hyphens put together as in . May 25, 2001
6: Control Structures 73 Step 4 says that the discount will only be applied if the $TotalCost value is lesser than or equal to $50. It should be if the $TotalCost is greater than or equal $50. August 21, 2001
6: Control Structures 75 Script 6.4 is missing the word discount on line 16. The text in the corresponding step is correct. July 31, 2001
6: Control Structures 77 The numbering of the steps inadvertantly begins with 2 instead of 1. May 25, 2001
6: Control Structures 79 The closing </HEAD> tags in Script 6.6 and in Script 6.8 through Script 6.10 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
6: Control Structures 81 In the third tip, the second statements line should read statement(s)2;. May 25, 2001
6: Control Structures 84 In creating Script 6.8 on line 16, and on page 85, under step 11, an
extraneous v character has been appended to the
<BR> just before the ending parenthesis.
6: Control Structures 85 Script 6.8, the backslash needed to escape the quotation mark for the word email is missing on line 26. The corresponding step instruction is correct. August 21, 2001
6: Control Structures 93 Script 6.10 actually returns non-prime numbers, if they are multiples of primes other than 2, 3, and 5 (e.g., 49). To correct this, you would need to add an array which records every prime and each new $n would be compared against this entire array.
6: Control Structures 94 I have no idea why, but 7 modulus 5 is listed as .4 when it’s really 2. Extreme mental lapse… May 7, 2003
7: Using Arrays 96 At the end of the second full paragraph, it should read …stored at a particular point…. July 12, 2003
7: Using Arrays 97 The closing </HEAD> tags in Script 7.1 through Script 7.5, Script 7.7and Script 7.9 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
7: Using Arrays 102 In step 6, the script fragment ?></body></html> is missing. July 10, 2001
7: Using Arrays 105 The text of step 7 should be printed as part of step 6. May 25, 2001
7: Using Arrays 106 Step 1 should read Open your text editor and create a new PHP document. May 25, 2001
7: Using Arrays 108 The text of step 11 should be printed as part of step 10. May 25, 2001
7: Using Arrays 113 In the caption to Script 7.8, it should read You don’t even have to specify keys for each field… not for each array. May 25, 2001
8: Regular Expressions 121 Table 8.1 (pages 121 and 266) is missing the * character which matches zero or more occurences, as it is written in the text itself. July 20, 2001
8: Regular Expressions 123 The closing </HEAD> tags in Script 8.2, Script 8.3, and Script 8.5 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
8: Regular Expressions 127 The last line of the second paragraph should read:
“[a-z]{3}” would match abc, def, etc..
8: Regular Expressions 128 The second pattern (testing en e-mail address) is missing the ending space before the final quote (as explained in the second paragraph of page 129.
8: Regular Expressions 131 The text for step 7 should really be printed as part of step 6. May 25, 2001
9: Creating Functions 135 The closing </HEAD> tags in Script 9.1 through Script 9.4 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
9: Creating Functions 139 In Script 9.4 and in the corresponding instructions, the second morning shoud be afternoon. September 24, 2002
9: Creating Functions 140 The last tip should read (changes indicated by italics): Technically if you pass a number as an argument in a function, it does not need to be within quotation marks but there is no harm in using quotes anyway to remain consistant as to how arguments are passed. May 25, 2001
9: Creating Functions 148 Scripts 9.7 and 9.8 contain extra spaces after the word widget(s). This is nitpicking, but it did annoy the author when he discovered it!
9: Creating Functions 149 Under step 5, the final paragraph should begin (change in italics) To demonstrate that the global statement and not To demonstrate that the global variable …. May 26, 2001
9: Creating Functions 152 Under step 5, the line of code should read:
print (CalculatePayments ($TotalCost));
as it is in the corresponding script (one closing parenthesis is missing).
May 26, 2001
10: Files and Directories 156 Figure 10.1 is repeated as Figure 10.2. Figure 10.3 should actually be Figure 10.2 and the real Figure 10.3 is missing. Click here to view the real Figure 10.3.
10: Files and Directories 159 Script 10.1 is missing the closing HTML tag. While the page will still function properly, it does constitute poor form.
10: Files and Directories 160 Scripts 10.3 and 10.6 are missing the php portion of the initial PHP tag. These scripts will still function properly if short tags are acceptable in your PHP configuration.
10: Files and Directories 160 The closing </HEAD> tags in Script 10.3 and Script 10.6 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
10: Files and Directories 170 In Script 10.6, the comment on line 10 mistakingly states that the WriteToFile function takes URL and Description as its arguments. It actually takes Username and Password. While this won’t affect the execution of the script, it has been changed in the downloadable versions available online. June 13, 2001
10: Files and Directories 170 In step 12 contains an extra srand(mktime()); which should not be there. The corresponding Script 10.6 is correct. July 26, 2001
10: Files and Directories 170 Script 10.6 has quote marks around the permisions for the mkdir() command. These quotes seem to cause problems on some systems. If you are experiencing difficulty with this aspect of this script, remove the quotation marks. August 14, 2001
10: Files and Directories 182 The last sentence of the caption to Figure 10.16 should read (addition in italics) Checkboxes are displayed giving the user the option of deleting, renaming, and uploading files. May 26, 2001
11: Databases 186 The closing </HEAD> tags in Script 11.1, Script 11.2, Script 11.4, and Script 11.5 are missing. While this will not affect the execution of the script, they have been changed in the downloadable versions. July 10, 2001
11: Databases 187 The images in Chapter 11 are off. First, Figure 11.2 should be similar to that in Figure 11.4. Figure 11.3 should be a simple “The database, NewDatabase, could not be created!” message. Finally, the images printed as Figures 11.2 and 11.3 actually belong with the script running from pages 193-196. Ugh. July 9, 2001
11: Databases 199 On page 199, under step number 4, the line
$Result = mysql_db_query ($Query, $Link);
should read
$Result = mysql_db_query ($DBName, $Query, $Link);

as it does in the corresponding script (Script 11.5).

12: Cookies 204 Scripts 12.1, 12.2 and 12.3 are missing the php portion of the initial PHP tag. These scripts will still function properly if short tags are acceptable in your PHP configuration.
12: Cookies 204 Script 12.1 is missing the opening <HEAD> and <BODY> tags. This also applies to step 5 on page 205. March 19, 2003
12: Cookies 208 In Script 12.2, the opening <HTML> tag is missing. June 8, 2002
13: Creating Web Applications 215 In Script 13.1, the closing </ TR> on line 11 (and also in Step 4) is missing it’s slash. April 15, 2002
13: Creating Web Applications 229 Script 13.9 is missing the php portion of the initial PHP tag. This script will still function properly if short tags are acceptable in your PHP configuration.
14: Debugging 238 Scripts 14.3 and 14.4 are missing the php portion of the initial PHP tag. These scripts will still function properly if short tags are acceptable in your PHP configuration.
14: Debugging 243 In steps 5 and 6, the slashes before the header() lines which would indicate that they are commented out are missing. The corresponding script is correct, however. July 10, 2001
14: Debugging 245 The closing </HEAD> tag in Script 14.6 is missing. While this will not affect the execution of the script, it has been changed in the downloadable version. July 10, 2001
Appendix A: Installation 251 There are a couple of errors. The first is that the printer fused two dashes (–) into one. Thus, in steps 5 and 7, the code –with-apache, –enable-track-vars and –activate-module should all begin with two dashes. Secondarily, the code in step 7 should read:

cd ../apache_1.3.14 ./configure –activate-module=src/modules/php4/libphp4.a
(The ‘s’ is missing after module=.)

April 6, 2002
Appendix A: Installation 251 In step 4, two hyphens are fused into one em dash. The code should read cd ../apache_1.3.14 ./configure –prefix=/www. August 17, 2003
Appendix C: PHP Resources 266 The first line of Table C.1 should read ! ++ — (again, the two minus signs were fused together).