Computer Bookshelf

PHP Web Development with Dreamweaver MX 2004 — Updates and errata

Note: Most corrections involve minor typographical errors. The most important changes affect the installation instructions in the Appendix. Since the book was published, both PHP and MySQL have revised considerably the recommended method of installation on Windows. Although the instructions in the book are correct for the versions listed as current at the time of writing, readers are recommended to follow the revised instructions.

Chapter 1

Page 14. Array Value Assignment. There is a superfluous curly quote after 'Jill' in the example. The correct code should read:

<?php
$students = array('John','Dick','Tom','Jane','Jill','Jack');
?>

Page 18. String Operators. There is a superfluous curly quote after 'John' in the example. The first line of the example should read:

$firstname = 'John';

Page 22. First paragraph. The last sentence should read: If the condition is met,
we print the text "You have logged in." (deleting superfluous words)

Chapter 4

Page 87. The fifth line from the bottom should read: Browsers will also revert to Quirks mode if you don't include any DOCTYPE at all.

Page 101. Creating CSS Classes. In the second paragraph, the name of the class should be myborder.

Page 122. Adding Page Content. The first sentence of the second paragraph should read: When you paste in your content, it will take on the font of the style that you set for the page’s preferences.

Page 127. In the code, the alt text for the final <img> tag should be contact.

Pages 137-141. Figures 4-29, 4-30, 4-34 & 4-35 refer incorrectly to global2.css. They should all refer to global.css.

Page 146. The fourth line of code refers to the wrong stylesheet. It should read as follows:

@import url("global.css");

Chapter 5

Page 155. In step 5, the underscore is missing from the field name. It should be artist_pk.

Page 156. In step 6, the underscore is missing from artist_name.

Page 166. In step 1, the final sentence should read: Then click inside the form on the page and add the text field and button.

Page 181. The caption for Figure 5-19 should read: Passing the primary key of a record to a page.

Page 195. Step 4 should read: Insert a hidden field. Name it artist and give the field the value of the artist_pk column from the rstCD recordset.

Chapter 7

Page 255. The final sentence of the first paragraph should read: Later in this chapter, you’ll see how to create your own command-type extensions.

Page 282. The first paragraph of step 5 should read as follows: The Code block portion of the dialog box is now enabled. Now, you can enter the code for this block, as shown in Figure 7-24. (The figure shows how the code will look after you have completed steps 6 and 7.) Enter the following block of code.

Page 287. The second sentence of step 2 should read: Change the label next to it to read 12 Hour Format.

Chapter 9

Pages 352-3. The first paragraph on page 353 incorrectly states that encryption normally increases the length of a string by a factor of three or four. In fact, the PHP hash functions md5() and sha1() used later in the chapter always create encryptions that are 32 or 40 characters long respectively. Therefore the pwd column requires no more than 40 characters, instead of the 60 recommended.

In the second and subsequent printings, a screenshot was dropped from page 380 to make room for this additional section on page 381:

Handling PHP Magic Quotes

Depending on your PHP configuration, a setting called magic_quotes_gpc may insert backslashes to escape any quotes or apostrophes in your sticky text fields and sticky text areas. To get round this, amend the code in step 7 on page 376 like this:

if (isset($error)) {
  foreach ($error as $message) {
    echo '<p class="warning">'.$message.'</p>';
    }
  if (get_magic_quotes_gpc()) { 
    foreach ($_POST as $key => $value) { 
      $temp = stripslashes($value); 
      $_POST[$key] = $temp; 
      } 
    } 
  }

Page 391. Step 6. Apply the magic quote fix described above.

Page 409. Step 6. The first line of code should read as follows:

if isset($_POST['pwd']) && isset($_POST['con_pwd'])) {

Page 410. Step 8. Apply the magic quote fix described above.

Page 412. Step 4. The reference to the use of md5() should be to step 6 of the previous section.