PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)

Welcome to the companion Web site for the fourth edition of the book PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide, written by Larry Ullman and published by Peachpit Press. This page is specifically for the book’s fourth edition, published in August 2011 (ISBN 0-321-78407-3). The first edition was published in May 2003 (ISBN 0-321-18648-6). If you are using the first edition of the book, you should go to that page. The second edition was published in June 2005 (ISBN 0-321-33657-7). If you are using the second edition of the book, you should go to that page. The third edition was published in December 2008 (0-321-52599-x). If you are using the third edition of the book (PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide), you should go to that page.

Beside the handful of pages dedicated to this edition of this book, there’s plenty of other content on that you might be interested in. Use the “Post Categories” links above to browse by general topic.

You can download the code for the book using the link below. If you have any questions or problems, I’d recommend using the book’s corresponding support forum, where you’ll get the fastest answer.


Every script in the text is available here to be downloaded. Some things you should know:

  • Although these scripts are named or numbered as they are in the book, they do include any updates and changes as warranted by errors that were found after publication. Thus, if you are having problems with a particular script, download the most current version here or check the errata section.
  • These are the scripts for the FOURTH EDITION of the book. If you are using a different edition, click the appropriate link above to find the correct page.
  • These scripts have been formatted with line breaks that will work on most systems running most text editors. If you have difficulty opening a script, try:
    • adjusting the way your text editor treats text files
    • using a different text editor, if possible
    • posting a message to the online forum, asking for help

Complete Set of Scripts and SQL Commands (175 KB, last modified May 1, 2012)

The extras mentioned in the book can be found in the appropriate chapter folders in the complete set of scripts and commands.

85 responses to PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)

  1. Hi Larry,

    Fyi, the download link is not working.


  2. Hi Larry,
    Congratulation for your new book.
    I can’t find sql commands after the download. Where can I find it?

    • Thanks, Sandy! Sorry about the missing SQL commands. I’ve added them to the complete set and reposted that. Let me know if there are still any problems. Thanks!

  3. Thanks for the book…such great information and explained very well….I am learning so much!
    BTW…where might I find Appendix A – INSTALLATION instructions?

  4. Hey Larry,

    I am very excited about the “PHP and MySQL for Dynamic Websites” 4thE and picking up my copy next week. I used “PHP for the Web” 4thE on one of my sites and was very happy with how thorough you were and how easy the book was to follow. I have looked at quite a few and that one was the best one for what I was working on. As a result, when I saw this book available, I ordered it right away! I look forward to this book and I want to thank you for your publications.

    All the best,

    Cinch Labs, Inc. (
    Web Developer/Development Team Coordinator

  5. Hi there,
    Just downloaded the scripts file, but not seeing the SQL scripts for chap 6 (specifically, for populating the forum database). Am I missing something?

  6. Ok, so the ISBN listed here for ” PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)” is (ISBN 0-321-52599-x). However when I search this is comes up with the same ISBN as listed for the third addition (0-321-78407-3). If I go to the “Buy it ” link it is directing me to the Amazon link that SHOWS a 4th Edition but shows the 3rd addition ISBN number. Which is the correct book? Can I assume the Amazon book is correct and there is a typo on your page? I need this for a class so I have to make sure I get the right book.

    As copied from Amazon:
    Product Details

    Paperback: 696 pages
    Publisher: Peachpit Press; 4 edition (September 23, 2011)
    Language: English
    ISBN-10: 0321784073
    ISBN-13: 978-0321784070

    • Hello Rodney. Sorry for the confusion and thanks for the interest in the book. The correct ISBN for the 4th edition (the most current one) is the 0-321-78407-3. I’ll fix the type.

  7. Thanks for the code and I appreciate it.

  8. I just started the PHP and MySQL for Dynamic Websites (4th) and I like your teaching method so far.

    And pleased to note that you are a Richard Brautigan fan! (page 18)

    • Thank you very much, Dan, for the nice words. And, yes, I’m a Brautigan fan. First read “Confederate General…” in college and was instantly enamored. An undervalued writer, in my opinion!

  9. Dan, I taught myself basic HTML back in the 90’s but have since run into giant brick walls when it comes to getting my head around the concept of CSS, PHP and MySQL. After buying your book around a month ago I really do believe I’m finally beginning to get it. I think the main problem was the thought of MySQL waiting at the end of the tunnel once I started getting comfortable with CSS and PHP, so I went straight to the Introduction to MySQL and it all seemed pretty simple, so much so that earlier today I not only accessed my first MySQL database but even set up the Users table.

    OK, so maybe I’m patting myself on the back a little prematurely seeing as I’m actually here at your site to grab script 2.1 so I can actually enter some data into from a web page (and I even read the bit about putting the actual connection script in a lower directory so nobody can see the login info 😉

    Anyway, well done so far Larry – I don’t know how you did it but you did!!

    • Thanks, Paul, for the nice words. Not sure how I did it, either, but I’m glad it seems to be working for people!

      • Don’t know why I called you Dan btw Larry. If it’s any consolation I called Ray Harryhausen “Harry” when I called a radio show he was appearing on.

        I’m onto Database Design now btw and it continues to make sense – amazing!

    • I’m with Paul on this one. I have been involved with web development since my early 20s, learning HTML and CSS very easily, and even configuring Apache servers for hosting, but the more in-depth and gritty scripting languages like PERL/CGI and PHP have always eluded me. I’ve tried a half dozen books, and was convinced I just had some kind of mental block. Now in my early 30s, the issue of needing to learn web programming in order to advance came up again some weeks ago and, after trying two other books and giving up again, I landed on this one. And I’m hooked! And I’m getting it!

      After a dozen years of trying and failing to understand, your book, Larry, has it all making sense! I’ve always known that I need to be taught things a certain way or it won’t sink in and this book has that through-and-through. To know what you know on a technical level and still be able to convey it in a rich and engrossing manner that actually educates and sticks is truly a talent! And I’ve been through so much material that avoids using practical examples as if that’s a bad thing but your material has a way of making me see the wealth of real world applications I can make use of.

      This book is course material in the truest sense. I’m very grateful!

  10. Hl Larry. Thanks for this book. It has been a great help and is so easy to understand. I’ll keep a good look out for your other titles. Thanks Andy

  11. Hi,
    I appreciate your book and it’s clarity.
    Just a problem I can’t find the way to Appendix A that is exlusively “on line”
    P Millet

  12. Sorry I have finally found the way to Appendix A (in the peachpit site)
    P Millet

  13. Not an error exactly, but in Script 16.5 it doesn’t mention anywhere that the DateInterval class wasn’t added until 5.3. I’m using 5.2.17 (hosted server). I was expecting the direct comparison not to work, but I got “Call to undefined function date_diff()” instead. So I guess add() and sub() wouldn’t work either.

  14. Hello Larry. How do I assign permissions as an administrator, supervisor and regular user? Greetings.

    • There are at least three answers to that question, depending upon what operating system you’re using. Which you don’t say. If you need help, please use the support forums and provide the necessary information in the process. Thanks.

  15. John D, South Africa April 26, 2012 at 9:06 am

    Hi Larry

    As someone who has been programming with classic ASP and MySQL for many years, your book has made my transition to PHP easier than I ever thought possible.

    Thank you so much!

  16. Hello Larry, i have the script with some users like: Administrador, Supervisor, cliente… but i can’t post in the Support Forums because i can`t validate my dates in your form.

    Your book is Greath!

  17. Great book, Larry.

    Just one, quite simple, problem – in chapter 17, “A note on Translations”, you mentioned Serbian translation. In sql.sql file, table ‘languages’ is populated with ‘Serbian’, but table ‘words’ doesn’t contain translation in Serbian. Same for Portuguese.

    If help for Serbian translations needed – feel free to ask 😉

  18. Yuki Horikiri June 3, 2012 at 1:32 pm

    Hello Larry,

    I am using your book, ” VISUAL QUICK PRO GUIDE PHP and MySQL for Dynamic Web Sites Forth Edition.” In Chapter 3, on the top of the page 79, it says, ” … Download the style.css file uses from the book’s supporting Web site (” There fore, I downloaded ” ” file. I see phpmysql4/13/htdocs/css/style.css, however, that is not the style.css file needed for the particular exercise on page 79. I am not able to locate the file. Please help me. Thank you very much.

  19. Hi,

    Been wading through the book and it’s great – thanks for your contribution.

    Question about the exercise on Page 192 – I’m a bit confused about something related to the “Database Design” messages.

    The first message is (0,1,2) which corresponds to the initial post on the “MySQL” forum by user_id “2”. The next message is (2,1,2), which (I think) would mean that the *same* user is responding to his or her own question – this did not make sense to me. Is this correct?
    Finally, you have (0,1,3), which is a completely new user_id saying “Okay, thanks!”, which confused me more.

    I would have expected the flow to go:

    (0,1,2) – user_id 2 posts a question
    (2,1,3) – user_id 3 responds to user_id 2’s question
    (3,1,2) – user_id 2 thanks user_id 3 for answering his or her question

    Am I completely missing something in these queries (the detail is below)?

    SELECT * FROM forums;
    SELECT user_id, username FROM users;
    INSERT INTO messages (parent_id, forum_id, user_id, subject, body, date_entered) VALUES
    (0, 1, 1, ‘Question about normalization.’, ‘I”m confused about normalization. For the second normal form (2NF), I read…’, UTC_TIMESTAMP()),
    (0, 1, 2, ‘Database Design’, ‘I”m creating a new database and am having problems with the structure. How many tables should I have?…’, UTC_TIMESTAMP()),
    (2, 1, 2, ‘Database Design’, ‘The number of tables your database includes…’, UTC_TIMESTAMP()),
    (0, 1, 3, ‘Database Design’, ‘Okay, thanks!’, UTC_TIMESTAMP()),
    (0, 2, 3, ‘PHP Errors’, ‘I”m using the scripts from Chapter 3 and I can”t get the first calculator example to work. When I submit the form…’, UTC_TIMESTAMP());


  20. The “Pursue” questions for Chapter 10, number 1.

    I can’t seem to get this right. Do you have the solution or maybe a quick explanation that would lead me in the right direction?

    Thank you.

  21. chapters 4, 5, 6 and 7 are missing from the zip file

  22. Hey Larry,I’m beginner in web development.I have done programming only in c++ and java..
    Can this book be used for begining with php.

  23. Hey Larry, your book is gr8

  24. Judging from the scripts, this book uses the MYSQLI class to interface with a db. Is PDO also referenced? Any particular reason you chose MYSQLI over PDO?

    • Thanks for your question. No, I don’t reference PDO in this book, but do explain it in my “PHP Advanced and Object-Oriented Programming” book. I choose MySQLI over PDO for several reasons. First, not everyone will be able to use PDO. Second, many people won’t be able to appreciate PDO without understanding MySQLI first. And third, PDO is more complicated to use.

  25. Hi Larry, I’m enjoying your book. However, I cannot locate the CSS file for Chapter 8 in the scripts download. Is it in another location on this website? Thanks.

  26. I can’t seem to find the print images or any sql scripts for populating the tables for the example in ch19 in the download. All the other files for ch19 seem to be there. What am I missing?

    • Sorry for the confusion. I can’t legally provide the print images, as I think I say in the book. I don’t have any SQL commands for populating the tables either. Just search online for some images/artists you want to use.

  27. Hey, This book is great! Just starting up my business with my Dad and I (, getting my head around PHP has never been easier. You teaching technique is great. Considering that I’ve just been paid for some work I’ve done based on the knowledge I’ve gained from this book, Which book should I be looking for a next step into advanced things like building a CMS?

  28. Hi Larry,

    I’m loving your PHP and MySQL book and your teaching technique – very clear and easy to follow. Everything I’ve covered so far makes sense my knowledge and understanding is quite shallow – I know I need lots of practice to get the depth – however, I’m not able to access the sql.sql file – I tried opening it but that didn’t work and I’m not sure what else to do….

    Kind regards,


  29. Larry, I am a ColdFusion, Oracle, UNIX, Mainframe developer but now working with my daughter with WordPress. She is starting to make her sites dynamic. So, in my researching to find an interactive facility to use with her sites, I selected PHP instead of something like Joomla. In selecting PHP, I found that your book PHP and MySQL allows me to make the transition from ColdFusion/Oracle to PHP/MySQL shortening my learning curve. I highly recommend this book for anyone transitioning from a large interactive web environment to smaller interactive web environment. Good job!!

  30. Thank Larry for writing such a wonderful book on PHP

  31. Larry, I just tried to download the code, and I was finally able to (after a long wait), but when I tried to unzip the file, WinRAR told me that the file is corrupted. Anyone else having this problem?

  32. Is it worth buying this book or will another version be coming out soon?

    • Thanks for the interest. This is the most current edition and right now there are no plans for a new edition (i.e., it’ll be a couple of years before another edition).

  33. Hi Larry, I admire your work. You did a great job with this book. The use of CSS helped make the examples look a lot less cheesy for beginners and actually helped me understand. Nice touch. I finished the book in a month and a week, typing all of the examples from the text and debugging the typos and taking notes on the explanations of the code. I don’t have time right now to do all of the review and pursue exercises but I will be immediately moving on to your Effortless E-Commerce with PHP and MySQL and PHP Advanced and Object-Oriented Programming Visual QuickPro Guide because I am in a rush. I really think a lot of what you have shown me has stuck though I would like to get back to those exercises if I get the chance.
    It is my opinion that in chapter 19 you should insert the order total into the session variable in view_cart.php so it is available to the checkout.php script. (I think that is what should be done, you never spelled that out). I think it would be a good opportunity to review that. You used a dummy value instead, which inserts the same total for every order.
    I strongly recommend this book to anyone perusing the forum. Thank you Larry for taking the time to share your expertise, it is difficult to find information like this that is understandable all in one place.

    • Hello David. Thanks for the nice words and for the feedback. I appreciate it. Thanks, too, for the interest in my other books. I’m glad they’ve been helpful for you.

  34. Hello, I got the “PHP for the Web” book not too long ago, and it was awesome. What book should I get next to go to the next level? Please provide an idea of the reading paths I should take regarding your PHP books.


    Didier Kebreau

    • Thank you very much, Didier, and my apologies for the delayed reply. I keep meaning to do a blog post on the sequence of books I’d recommend, but never see to find the time. After the “PHP for the Web” book, “PHP and MySQL for Dynamic Web Sites” would be the logical choice. There’s some overlap in content, but the PHP and MySQL book uses different examples, and goes much, much farther into both PHP and MySQL, plus there are several fairly complete example sites. Thanks again!

  35. Hi,

    For someone who knows HTML5, CSS3 and JavaScript – is this book good as the next step or “PHP for the Web: Visual QuickStart Guide”?


    • Hello Phil. Sorry for the delayed reply and thanks for your interest in my books. If you’re solid with JavaScript, and learn pretty well independently, I’d start with the “PHP and MySQL…” book. It goes at a fast pace, but is fine for people with some programming skills. The “PHP for the Web” book goes at a much slower pace, and is intended for those that have never programmed before. Thanks again!

  36. Hi,

    I’m thinking to buy this book, but after reading comments on – I noticed that the book has “the two-column formatting”:


    “The two-column formatting of the sources codes, in less than A4 wide pages, makes several lines of code wrapped. It makes reading the source codes difficult… ”

    I can say that I really do not like two-column formatting… Is it possible to buy a book that does NOT have “the two-column formatting”?

    Sorry, my English is bad.

  37. Are you thinking of writing another version of this book.
    I’ve really liked the fact with the newer pearson books that they’ve included an e-book.

  38. Peter Johnson May 22, 2014 at 3:11 pm

    Hi Larry. I’m loving the book. I’ve been out of the coding biz for a while and your guidance is perfect for getting me up to speed.
    FYI, however, the calculator routine (script 3.10) has an error in line 30 for the calculation of dollars.
    The code “$dollars = $gallons/$ppg” should be “$dollars = $gallons*$ppg”.

    • Paul Merideth May 22, 2014 at 7:01 pm

      Funny … I just found the same error and came to this site to report it.. I also love the book and find it’s a great learning resource.

  39. Across-Atlantic Friend June 9, 2014 at 7:00 am

    Male oriented book (fourth edition).

    Figure B on page 148 shows that Ringo Starr is the second person registered in the ‘users’ table but, according to figure A on page 138, it is evident that the second person who registered in this table was poor Zoe Isabella: their registration dates are, respectively, 2011-03-31 21:15:07 (Ringo) and 2011-03-31 21:14:23 (Isabella) while the first one is yours, on the same day at 21:12:52.

    My judgment is intentionally provocative, it wants to be just a bit eye-catcher :)
    P.S.: there might already be an errata corrige somewhere so, in that case, I am sorry to duplicate that “but” report.

    Kind regards

  40. Across-Atlantic Friend June 10, 2014 at 6:59 am

    Hey! You tricked Phil !!!!!
    You wrote “you’re” insted of “your” !!!
    That’s unfair 😉

  41. Hi Larry. I’m from China, First of all, I want to thank you, this book help me a lot, thanks! And i wonder know where I can find the CSS file ( Script 3.1. Page 70 ) Look forward to your reply..

Trackbacks and Pingbacks:

  1. “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” (4th Edition) Now Available! (-ish) – Larry Ullman - September 11, 2011

    […] available for purchase, or in bookstores, now or very soon. For details about the book, please see its corresponding pages. I’ve also created a new forum for this edition.Thanks to everyone for their interest in the […]

  2. What is Larry Thinking? #45 => Olio – Larry Ullman - October 25, 2011

    […] available for purchase, or in bookstores, now or very soon. For details about the book, please see its corresponding pages. I’ve also created a new forum for this edition. Thanks to everyone for their interest in the […]

  3. Starting From Scratch! Woohoo! | The Eye of Saargus - April 27, 2012

    […] (which is excellent, mind you), I had no other source of learning for a long time. The book was the PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide. I read the first […]

  4. New Book – PHP and MySQL | SS-Home - October 24, 2013

    […] have purchased a new book – PHP & MySQL for Dynamic Web Sites by Larry […]

  5. Dynamic Web I Coursework : Portfolio | Class Projects - November 7, 2013

    […] Downloads […]

  6. Dynamic Web I Coursework : Portfolio | Class Projects - November 7, 2013

    […] PHP and MySQL for Dynamic […]

Leave a Reply


Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>