What is Larry Thinking? #6 => "PHP 6 and MySQL 5 for Dynamic Web Sites"

November 11, 2007

In this edition…

About this Newsletter

So it turns out that a month–how long it’s been since the last newsletter–can go by pretty quickly! Most of my time has been spent finishing the the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide”. I’m very happy to say that the writing is done! I’m just looking over PDFs of the chapters now. The book will go to print this month and be out in December. I’m therefore dedicating this newsletter to this new book, including giving away some copies.

I’m also planning on sending out a Mac newsletter within the next week. It’ll only go out to those that checked Mac/Mac OS X as one of their interests when they subscribed. If you’d like to get this next newsletter, update your subscriptions (there should be a link at the bottom of this page). Alternatively, you can always view newsletters online at https://www.larryullman.com/tag/newsletter/. My thanks, as always, to those that provided feedback on the previous newsletters. Please keep your questions and suggestions coming.

What is Larry Thinking => Introducing “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)”

I’m just wrapping up the editing of the third edition of my popular “PHP and MySQL for Dynamic Web Sites” Visual QuickPro Guide”. This edition covers PHP 6 and MySQL 5 and so has been entitled “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide”. I’ll provide a preview of the technologies and the book…

PHP 6, which should be released sometime in 2008, has two big changes. The first of these is cleanup. There are several “features” included in PHP 4 that were disabled in PHP 5 and then completely removed in PHP 6. Of these, the most important are register globals and Magic Quotes. Both were handy features but were relied upon too much, leading to potentially security holes. In PHP 6, these are gone, which will break some code, but mostly code that’s insecure (and therefore already kind of broken). The second big change is support for Unicode. It takes several pages to describe why this is important but basically PHP 6 can handle characters in multiple languages. Not only can a PHP 6 script work with Unicode data (say from a form or database), but you can also now write some of your PHP code in German, Japanese, or Cherokee. For those of you for whom English is not your native language, think about how nice it’ll be to be able to name variables and functions in your own language!

MySQL 5 has some new features but they don’t impact this book that much. This book uses mostly basic SQL/MySQL. More advanced features of MySQL are covered in my “MySQL: Visual QuickStart Guide (2nd Edition)”.

In terms of this new edition, I want to start by making it clear that most of the examples absolutely will not work for earlier versions of either PHP or MySQL. The main reason is that this edition exclusively uses the Improved MySQL extension functions, available as of PHP 5/MySQL 4.1. If you’re still using older versions of either, the second edition of the book will still be available. As support for PHP 4 is ending in 2007, I do expect there to be a fairly rapid change in support for PHP 5 and then PHP 6 over the next two years.

The table of contents for this book have been posted online but I’ll run through some of the highlights. The first three chapters–covering basic PHP–are relatively unchanged from the second edition, aside from removing references to features that are no longer present. I’ve broken up Chapter 5, “Introduction to SQL and MySQL”, into two chapters. In the new Chapter 4, “Introduction to MySQL,” I now also briefly go over how to use phpMyAdmin, a common request. Otherwise, the two chapters on SQL are relatively unchanged, except that Chapter 7, “Advanced SQL and MySQL,” now uses a new example for all of its instructions. The two chapters introducing how to use PHP and MySQL together have been updated to use the Improved MySQL extension functions. Chapter 11, “Cookies and Sessions,” has also been updated to use the Improved MySQL extension functions and I’ve streamlined some of the processes in that chapter.

The next three and a half chapters in the book are entirely new. To start, Chapter 12, “Security Methods,” has about 50% new material and is otherwise a new organization of existing ideas. It’s introduces and shows how to prevent common attacks: spam, XSS, SQL Injection, brute force, etc. I think there’s some very good information in there. Chapter 13 is on Perl-compatible regular expressions (PCRE). This is the first time I’ve discussed PCRE in any of my books. They’re more complicated than the POSIX style I normally teach, but PHP is definitely leaning towards favoring PCRE over POSIX. Chapter 14 is called “Making Universal Sites”. It discusses character sets, encodings, and Unicode. There are many examples on displaying characters in multiple languages, sorting words in multiple languages, and even transliteration. It’s pretty cool stuff, in my opinion. There’s also a discussion of locales in PHP (they’ve been around for a while but not something I directly addresses before) and time zones in MySQL. All of the examples in this chapter go towards making Web sites with broader appeal. The last new chapter is a message board/forum example. People have requested this frequently so I put something together. It’s surprisingly simple, so to make it more interesting, I created a multi-lingual forum, where everything on a page shows up in different languages. You can see screenshots from this chapter online.

So in short, the book has 3.5 entirely new chapters, plus some new additions in other chapters and some deletions (both because of changes in PHP and to make room). I’m hoping people will like this edition as much as they’ve liked the first two. As a reminder, you’ll want to be using PHP 6 to get the most out of this book. If you own one of the other editions, I recommend that you look this one over (at a library or your bookstore) to make sure it’s worth your hard-earned money (I hope it is but never want readers thinking they wasted their cash). At the time of this writing, Amazon.com has the book selling for $26.39. I don’t know if that’s going to change or if the book will be available in electronic format, in your country/language, etc. (I know surprisingly little about the actual selling of the books). I you have any questions about this book, let me know.

Book Giveaway: Building a Web Site with Ajax: Visual QuickProject

You must be subscribed to the newsletter to qualify for the book giveaway.

My Book News

The big news is the completion of my “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)”. It should hit the shelves by the end of the year. And my “Buildling a Web Site with Ajax: Visual QuickProject Guide” is also available. It’s a different style of book for me, with more direct instruction and less explanation and theory. The code, I believe, is quite solid and reusable, which should result in a reliable Ajax experience for the end user. It looks like Amazon is selling it for $13.59 (as I write this), which is a good deal (one of the many reasons I like writing for Peachpit Press is that it’s nice to have good computer books available for under $20).

In terms of other news, I’m going back to focusing my energies on the Adobe AIR book, highlighted in the last newsletter. A second beta version of the software has been released.

Finally, it looks like I’m going to be writing a book on Ruby in Fall 2008. More on that in time…