Corrections for my books

I hate it when I find a mistake in a technical book—particularly when it’s one of mine. There’s nothing more frustrating than trying to learn a new concept and hitting a brick wall because the code doesn’t work. Mistakes creep in for a variety of reasons. But whatever the reason, I know I’m letting down my readers if there’s a serious error in one of my books. So, as well as trying to avoid errors in the first place, I try to respond to error reports as quickly as possible.

I recently discovered that friends of ED has closed its website and merged it with that of its parent company, Apress. Unfortunately, none of my books’ errata are yet listed on the new site. So, I’ve scrabbled around to put them back together and host them here. You can find the corrections for the following Apress/friends of ED titles on this site:

I find it hard to believe that there weren’t any mistakes in The Essential Guide to Dreamweaver CS4, but I can’t trace any record of corrections. I haven’t gone back to some of my older books. Good though they were, they’re based on versions of software that are no longer supported. What’s more, most of them were reprinted with corrections.

I also plan to keep up to date the corrections pages on this site for the books I have published with Adobe Press.

If you come across any errors or code that doesn’t work, please report them directly to the publisher. That way corrections can be incorporated into reprinted versions of the book. But if you don’t get an acknowledgement from the publisher within a day or so, please leave a comment here, and I’ll try to deal with the issue as quickly as possible.

This entry was posted in Books, Dreamweaver, Flash, PHP. Bookmark the permalink.

39 Responses to Corrections for my books

  1. Bob Leigh says:

    David, are there any corrections to “Getting StartED with CSS”?

  2. David Powers says:

    Hi Bob,
    No problems have been reported to me. Is there something particular that you’re concerned about?

  3. Bill Graham says:

    I really like your book but have had issues when working through Chapter 4. On page 145, the changes to test_validator_01.php and validator.php did not display the print_r when the submit button was clicked with empty fields. This happened over several browsers. It still did not work when I tried the one you wrote, test_validator_02.php. When I tried test_validator_03.php, I received this message: Cannot access protected property Pos_Validator::$_filterArgs in /Applications/MAMP/htdocs/oopsolutions/ch4_exercises/test_validator_03.php on line 12

    Has PHP changed since the example files were published? Have you seen this issue before? I am disappointed because I wanted to learn and use your class for validation. Please help me get around these issues.

    I am on a MAMP environment running PHP version 5.3.2. Input filter is enabled, it is revision $294106$, The default is unsafe_raw. Any leads would be appreciated. Thank you. Bill

  4. David Powers says:

    Hi Bill,

    I’ve written a lot of books, so it’s always a good idea to say which one you’re referring to when asking for help troubleshooting a problem. Fortunately, the error message reveals that it’s PHP Object-Oriented Solutions that you’re having difficulty with.

    I have just fired up an old MacBook Pro that has exactly the same version of PHP that you’re using, and downloaded the book’s source files to make sure that I was working with the same code as you. I ran test_validator_02.php, and it works exactly as described in the book. If you click Send Comments before making the changes in step 2 on page 145, nothing is displayed. But after adding print_r($this->_missing); at the end of the checkRequired() method in Validator.php, the array is displayed at the top of the page. If you have made the change, and you’re still not getting the array displayed, it sounds as though you’re making the changes to a different version of Validator.php. Check the path in the require_once command at the top of the page. It refers to Validator.php in the Pos directory.

    With regards to the error you’re getting in test_validator_03.php, step 2 on page 156 instructs you to change the visibility of the $_filterArgs and $_errors properties temporarily to public. It sounds as though you have forgotten to do so, or that you’re making changes to a different version of Validator.php.

  5. Bill Graham says:

    David,

    I apologize for not stating the book title. I was too focused on getting the details right I guess! In any event, like every user, I swear after editing the first version without the expected results, I ran test_validator_02.php straight from your files and it did not work. Now that I have whined and wasted your time, they both work. I know, most likely user error! I can not say what was going on but will try to connect with the magic on my own before bothering you again. I can now finish your book which I find very helpful. Thanks again for taking time to respond to my questions.
    Bill

  6. Dan Ferry says:

    David,

    Really enjoying working through the examples in “Dreamweaver CS5.5: Designing and Developing . . . “, using my Mac Pro with OS X 10.7.1 and Dreamweaver Version 11.5 Build 5315. However, In Chapter 7, using your complete code, when I incorporate trnotes.js, Live View turns completely blank. The code works fine in “Preview in Browser” for Chrome and Safari.

    More details:

    Dan

  7. David Powers says:

    Hi Dan,

    Your question was also forwarded to me by Adobe Press, so you should have already received the answer. For the benefit of anyone else who might encounter the same problem, the reason nothing is displayed in Live view is because trnotes.js accesses features such as geolocation and web SQL storage, which are not supported by the version of WebKit in Dreamweaver.

    The Tip at the top of page 242 advises you that you need to preview index.html in Safari or Google Chrome to test the app at various stages of development.

  8. Saad says:

    Hi David,

    First of all I really like the way that you explain and use Dreamweaver, you make it easier to use it thank you.

    I don’t know if its something you missed or I might understand it wrongly anyway when I use PHP to generate xml file as you explained in Essential Guide Dreamweaver CS4 you mentioned that we can get rid of unwanted HTML and I did that and it didn’t work till I deleted even the last code php which is (mysql_free_result) , so I don’t know if its something is missed here in book but as I said before I like all your books and videos thank you for helping me to improve myself in webdesign.
    Sorry my English is not perfect

    Thanks..!
    Saad Allaghi

  9. David Powers says:

    Hi Saad,

    Thanks for your comments. I’m travelling at the moment, so don’t have access to a copy of my Dreamweaver CS4 book. It’s also a long time since I wrote it, so I can’t remember the details. I suspect that my comment about getting rid of the unwanted HTML included the PHP block after the closing </html> tag.

  10. Hal Hickey says:

    Hi David,

    I first submitted this through APress who responded by stating they do not offer technical support.

    I have purchased PHP Solutions 2nd edition and am working my way through
    the code. In Chapter 5, page 120, step 5, I have tried incorporating the
    code in the spot as per the book. However, the error message indicated in
    this step is never displayed. Only the error “invalid email address” is
    displayed. So the code in this step is not working. I tried all of the versions included in the download file, with no success. As this is fairly
    important code to prevent someone using Bcc or cc, I would like to know
    how to fix it.

    There is an update on the APress Errata page which states this block of code
    should be placed as per “This block of code needs to be inserted AFTER the
    require(‘./includes/processmail.inc.php’) statement for it to work
    correctly.”. I have tried this and in fact tried to insert the code in several other places as well however, there is no change to the error message and by extension, I assume error checking.

    Please advise if this has a solution?

    Sincerely,

    Hal

  11. David Powers says:

    Hi Hal,

    Many apologies for the great delay in replying. I was abroad when your post arrived, and I have only just got round to dealing with the backlog.

    I’m sorry that Apress wasn’t more helpful. They usually forward potential errata to me for verification, but your message wasn’t passed on. I have just tested the code in the book, and it works exactly as expected. The “Sorry, your mail could not be sent. Please try later.” message will be displayed only if a suspect phrase is detected. If it’s simply an invalid email, it won’t trigger that message.

  12. JEFF CHASE says:

    I was trying to access your friendsofed website to get the downloads for your PHP book but got a message that the site had a problem, required a sign in and was advised not to open the site.
    Is this a bigger issue or just my computer?

  13. David Powers says:

    The friends of ED website closed down ages ago, and was merged with that of its parent company, Apress. I presume that you’re looking for the files for PHP Solutions. The details of where to find the source files are on the book’s updates and corrections page, where’ll also find other information that will help with the book.

  14. LP Singh says:

    Hi David,

    While highly admiring PHP Solutions 1st Edition, I seem to be missing a piece on page 337, Ch 12, 2nd para: “You must also include the value of the current page in the query string generated when you click a thumbnail. If you fail to do so, $curPage is automatically set back to 0, and the first set of thumbnails is displayed instead of the current subset.”

    Question: Since $curPage derives its value from $_GET[‘curPage’], and $_GET[‘curPage’] derives its value from the URL into which $curPage is inserted, they are in a circular reference. Besides there seems to be no way to determine how the value of $curPage is incremented after every predetermined (SHOWMAX) number of thumbnails.

    Sorry if I missed something elsewhere in the book. Please advise.

    LP

  15. David Powers says:

    The value of $curPage comes from $_GET['curPage'] only if it’s included in the URL. If it isn’t in the URL, it’s automatically set to zero by the code in step 3 on page 334:

    $curPage = isset($_GET['curPage']) ? $_GET['curPage'] : 0;

    The value of $curPage is incremented or decreased by the code in step 1 on page 337 (it’s increased in the 3rd line from the bottom of the page):

    ?curPage='.($curPage+1)

  16. LP Singh says:

    Thanks David, the beauty lay in reading the same code in the light of your reply.

    LP

  17. I just bought your book PHP Solutions 2nd edtion. I have taken and online course on PHP an MySQL but have not been able to advance my skills to develop my website to enclude php code. During the online course I installed a WAMP server that I will use with your book. If you look at my website it is very basic and has few bells and whistles. I want to add an interactive page for the troop members to use. This will be done on the current events page.

    Using PHP in an existing website

    I am want to add PHP to my website. You indicate I must change my extension of my filenames from .html to .php. The page I will modify to php will be the current events page. The page file name is announcements.html. When I add the php code will I need to change the file name to announcements.php or will I only have to insert in the code?

    Should I change my index file from .html to .php at the sametime.

    Please understand I am still a novice at website development. I started learning this at the age of 70 two years ago. I find it very challenging and rewarding.

  18. David Powers says:

    Any file that contains PHP code needs the .php filename extension. If your main page doesn’t contain PHP code, there is no need to change the .html filename extension, but it’s generally a good idea to use the .php extension on every page in the site.

  19. Atlantis says:

    David I purchased your php solutions 2nd edition book and I’ve found it very problematic. Errors, no download site, bad scripts once I found the other site, some scripts are completely blank, etc. I’ve wasted weeks of my life because of your book errors trying to learn php. I am very upset and confused. The book started off very clear and great but then got very problematic and confusing due to the errors.

    To be honest, I find it hard to believe an editor actually edited this book; there were so many errors and problems.

    I need your help now please.

    I am creating a simple online gallery and I am using your download script to allow the user to download the selected image.
    The download script indeed downloads the correct image but there is no way to output text telling the user the image was downloaded. How can I do this?

    Every way I try to echo text on the download script it throws errors and fails. I tried using ob_start, etc. and it still does not work for me.

    I am using session variables to track if the download happened so my thoughts were to check if the session variable was set and if so, use echo to output a message to the user saying the download happened.

    Can you please post a version of the download script that outputs text after the download happened so I know how to do this?
    When I’ve tried it, I get errors like this:
    Warning: Cannot modify header information – headers already sent by (output started at /home/thephpscript.php5:82) in /home/thephpscript on line 88

    You’ve mentioned these types of errors in the book but nothing I do gets it working.

    If it is not possible for a php download script to output text/HTML after the download is complete, can you tell me how I reload/refresh the calling script so my session variable download check can output the correct download completed message?

    Please help, thanks.

  20. David Powers says:

    @Atlantis, I’m sorry to hear of your problems with my book. It’s unfortunate that the friends of ED website was closed down without redirecting automatically to the Apress site, where the source files are now hosted. But I’ve made every effort to publicize the correct location. However, it’s extremely difficult for me to respond to criticism of errors and bad scripts without any details. Have you submitted details of what you believe to be mistakes and bad or missing scripts to Apress? You can do so by clicking the Errata tab on the book’s page on the Apress site. Apress usually submits such reports to me within 24 hours for me to verify and correct if necessary. The last time that Apress sent me such a query was on 17 November 2011.

    You say you find it hard to believe an editor edited the book. I can assure you that I worked with one of Apress’s best editors. I also had the good fortune to work with a technical reviewer who is an experienced programmer and author, but not a PHP expert. As a result, he was able to point out issues that might confuse newcomers to PHP. In the final analysis, though, any shortcomings or errors in the book are my responsibility alone. I have published a list of known errors on my website. It’s quite a short list for a book that’s 500 pages long and was published nearly two years ago. If there are as many problems with the book as you say, I’m genuinely surprised that they haven’t been reported before now.

    Finally, you ask for help with adapting the download script, which does work as described in the book. I’m sorry, but what you’re trying to do is not possible. As it says on page 210, “The script in this PHP solution sends the necessary headers, opens the file, and outputs the contents as a binary stream.” If you look at the script, it sends four HTTP headers, one of which sets the image file as an attachment. Once that has been done, it’s impossible to send text. It’s also impossible to reload the calling script because that involves sending new headers. Once output has begun, you cannot send new headers. That’s not a failing of PHP, but the way that the HTTP protocol works. To the best of my knowledge, you’re seeking to do the impossible. However, if anyone can enlighten me as to how it can be done, I’d be delighted to know.

  21. Atlantis says:

    Hello David.

    Thanks for the quick reply.

    At this point in time I don’t exactly recall what I told Apress about the problems as it was some time ago (over a month). Because of the issues I turned to the web for help.

    Regarding the bad scripts: Yes if I remember correctly some of them were completely blank, with no code at all while others had issues. When I get time I may go over them and report back to you but I’m extremely busy and behind in my development. I do not have the luxury of excess time or money.

    There was also an issue with one of the database scripts where my MYSQL database wouldn’t work because of the names you provided. I think there was one to read and one to write. I am not looking at the book but something like psread or pswrite. I would have to look in the book and check my script. I couldn’t figure out why the script wasn’t working, then I finally changed the names you provided and the script worked. There were also multiple book errors.
    These are just the errors I’m remembering. I actually stopped reading your book because of the various issues, the time lost and frustration caused.

    Another issue was that the gallery didn’t display your images all the same.
    For some reason some of the images weren’t positioned correctly. I don’t know if this was your code’s error or what.
    Later I might look at it again. I was using Mac OS X and Safari 5.1.5. I don’t remember if I tested it on another browser.
    It might been caused by the different picture sizes and how the browser positioned them.

    One reason why many people may not be reporting errors is because many people in life don’t follow through. Especially if they buy a low cost product and it’s broken, they often do nothing. Another reason is the website the book talks about is gone with no leads to this blog. Most people give up or perhaps purchase other books or try to learn online for free. I’ve come to realize this by using another software product which is filled with bugs. People give up quite easily when sold something broken. Very few use their time to complain or file bug reports.

    Because of the issues I turned to the web for get help. I initially bought your book and avoided the web because I wanted to learn php from clear, easy direct lessons and the web can often be non-direct. If my gallery was working the way I want I might not of even posted here mentioning the problems like I’m sure many others have not done.

    I’m thinking about purchasing your DreamWeaver book but because of the issues with your php book I am going to have to really inspect it first and read what others say about it on Amazon.

    Moving on to the current problem and I thank you for your help here.

    Is it possible to do this:

    Put the download code into a function on the calling script/page so the page calls itself to perform the download then refreshes itself so I can show the download has been done by echoing some text?

    If not, then how do people get notified of the download?

    There must be some browser compatible way to do a download then notify the user with some type of text message affirming the download took place.

    Thanks.

  22. David Powers says:

    @Atlantis, I, too, am a busy person, but I take reports about problems with my books seriously. I have just downloaded the example files for PHP Solutions, 2nd Edition, from the Apress website. I cannot find any blank files. The classes/Ps2 folder is empty, but it’s not meant to contain any files. It’s where you create your own versions of the classes in the classes/completed folder.

    There is an error on page 307 concerning the database connection, but the correction was added to the errata page on this site as soon as the problem was reported. It’s also listed in the errata on the Apress site.

    You imply that my book is “broken” and full of errors. I’ll be happy to fix them, but I can’t do so without knowing what the problems are. I’ll ask my editor to check if your report was inadvertently overlooked by the staff at Apress.

    Sometimes, though, “errors” are reported to me that turn out to be the result of the reader missing a vital step in the instructions or misspelling a function or variable. I’m not saying that’s necessarily what’s happened in your case, but it’s surprising that the book has received so many positive reviews on Amazon if it’s as bad as you suggest. PHP Solutions, 2nd Edition, was also chosen by PHP Boston for three seasons of its PHP Percolate self-study programme. For a couple of seasons, I participated directly in their forum, clarifying aspects that some members found difficult to grasp. But there were no reports of errors other than those already documented.

    As for your question about how people get notified of a download, I download many files a week from a variety of sources. I normally use Firefox on Windows, but occasionally use Chrome or Internet Explorer. Each browser always displays a dialog box informing me that the file has been downloaded. When I use Safari on my MacBook Air, a progress bar is displayed at the top-right of Safari as soon as the download starts. When the download is complete, the file bounces several times in the Dock to draw my attention to it.

  23. donald says:

    Hello,
    I am having a problem with the code in Chapter 9 of PHP Solutions 2nd Edition. I create the login form and attach the authenticate.inc.php, filetest_02.txt, and menu.php. When I type in username: david and password: codeslave, I still receive the error ‘Incorrect username or password’. Everything is in the correct place and linked appropriately. Thanks for the help.

  24. David Powers says:

    Are you on a Mac? If so, have you set up the private folder so that PHP has read and write permissions for the folder?

  25. donald says:

    I’m on a windows 7 pc. I have all the files in the same folder. Do they have to be in a private folder?

  26. David Powers says:

    They don’t need to be in a private folder, but the links in the example files assume that filetest_02.txt is in C:/private, and that authenticate.inc.php is in the includes folder in the site root.

    The reason filetest_02.txt is in a private folder outside the site root is because it contains login details. If you leave the file with login details inside the site root, anybody could discover the file and hack into the restricted pages.

  27. donald says:

    Ok, I put the filetest_02.txt in the private folder and the rest of the php files are in the same folder linked correctly. I type in username: david password: codeslave and still get incorrect username or password.

  28. donald says:

    I don’t know if this will help but this is login_02.php

    Login

    <?php
    if ($error) {
    echo "$error”;
    }
    ?>

    Username:

    Password:

  29. donald says:

    The comment section will not let me put in php code

  30. David Powers says:

    No, you cannot put PHP code into a comment. It’s a security measure to prevent hackers and spammers.

  31. donald says:

    The Session is not getting authenticated so I am getting an invalid username or password and the code was downloaded

  32. David Powers says:

    Does line 6 of login_02.php look like this?

    $password = sha1($username . $_POST['pwd']);

    If so, that would explain why it’s not working. It should be the same as in step 2 on page 252. In other words, like this:

    $password = $_POST['pwd'];

    The sha1() belongs to PHP Solution 9-8 later in the same chapter.

  33. donald says:

    Ok, I deleted that and now it is able to access the text document. It still is giving me invalid username or password though.

  34. David Powers says:

    Give me some time to test it.

  35. donald says:

    ok thanks for your help sir.

  36. David Powers says:

    I’ve done a lot of testing on the files and code, and have discovered what appears to be the problem. It’s only when you use the first name and password in the list that it fails. It works if you try logging in with “chris” as the username and “bigboss” as the password.

    I used echo to display the values of $tmp[0] and $username for the first line. They both contain “david”. But when I used == to compare them, they weren’t equal. As far as I can tell, what’s happening is that there’s a hidden character (possibly the byte order mark, or BOM) at the start of the file, which is preventing the username from matching. Even using the trim() function on $tmp[0] fails to remove it.

    The solution (although it’s not one that I’m very happy with) is to insert a blank line at the beginning of the text file, filetest_02.txt. This eliminates the invisible character that appears to be preventing the username on the first line matching the input value. What puzzles me is that this worked perfectly when the book was originally published two years ago, but I’ve tested it on both PHP 5.3 and 5.4, and it no longer works. I’ll try to dig a bit deeper into this mystery. Thanks for bringing it to my attention.

  37. donald says:

    Yeah it works with the second name. Thanks for helping!

  38. David Powers says:

    I’ve finally discovered the cause of the problem. The version of filetest_02.txt in the download files was saved in Windows Notepad with UTF-8 encoding. If you resave the file in ANSI encoding, it works. I’ve added the details to the errata page.

  39. Joe Bowman says:

    Hi David, Like most everyone else I have found your work to be very helpful. I am currently using ‘CSS and HTML Web Design. In Chapter 8 there is a process_mail.inc.php file that cleans form entry data and then sends it via email. It all works great except for the fact that when I open the form I get an error message at the top of the page that says,

    Warning: Invalid argument supplied for foreach() in /………./process_mail.inc.php on line 78

    I’ve gone over and over the syntax and cannot find any problems and dreamweaver doesn’t see any either. The code works fine. When I send feedback through my form it is delivered to the required recipients and everything is great. It’s just that ugly little error message at the top of the form page.