Monday, April 6, 2009

Review: Head First PHP & MySQL

Authors: Lynn Beighley and Michael Morrison Format: Paperback, 812 pages Publisher: O'Reilly Media, Inc. (December 30, 2008) ISBN-10: 0596006306 ISBN-13: 978-0596006303 The good news is all you need to use this book is some prior experience building static web pages using HTML/XHTML...sort of. That's what the Who is this book for? section says. However, the Who should probably back away from this book part says that anyone who isn't familiar with basic programming concepts like variables and loops should steer clear. On the other hand, the same section declares that those basic concepts can be learned from this book. OK, just a tad confused here. Actually, the one piece that would bind all this together would be the mention of JavaScript (and there's a Head First book for that, too). Not sure why JavaScript wasn't mentioned, but it would have been a good bridge linking the rank web design beginner to this book, since JavaScript also makes static HTML pages dynamic. Also, folks familiar with JavaScript would certainly be familiar with basic programming concepts. Be that as it may, let's move on. This book contains certain predictable bits that you'd expect in any Head First book. It's loaded with diagrams, graphics, and "retro" photos from what looks like old 1950s sitcoms. It's written for someone who forgot to take his or her Ritalin today and is in desperate need of said medication. The book teaches technology using scenarios that at least the book series and O'Reilly considers interesting if not important to the late high school and early college reader. Of course, there's a bit more to learning and using PHP and MySQL then learning to write code in a text editor. Will this book successfully teach the beginning web designer how to use server-side scripting and relational databases? The Read Me section in the front matter didn't look like the usual Head First boilerplate and it is necessary to read, because it holds the keys to using this book. The authors stress that repetition is absolutely necessary, so don't skip around the book. If you know enough PHP and MySQL to do that, you probably don't need Beighley and Morrison's tome anyway. You start learning the easy parts first, then move on to the more complex (nothing revolutionary there), but keep in mind, this book isn't one stop shopping. There's just too much going on with these technologies to teach you everything. The book is here just to teach you enough to get you going. You will absolutely, positively need a web server that supports PHP and MySQL. Before you do anything, blast to the back of the book and see the Appendix section for how to install all that on your local machine. Seems like you'll need just a bit more knowledge (or at least a lot of confidence) than just playing around with HTML tags for this one. Actually, the very beginning of the book doesn't really require that you have your web server set up, since you need to learn the basics of PHP first, but it couldn't hurt. At least once you get to the point where you'll need a web server, you won't have to halt the learning process and install everything. Personally, I'd just set up LAMP on a Debian box and call it good, but the instructions for installing PHP and MySQL on your local computer provided by the authors covers Windows 2000, Windows XP, Vista, and Windows Server 2003/2008. If you're a Mac user, OS X 10.3x or newer is supported. What? No Linux? These *are* open source technologies, folks and it's not like O'Reilly is a "Microsoft-only" publisher. OK, so they're playing the odds, figuring that most people run Windows and a significant minority run Mac, but I was still disappointed that they didn't give Linux a nod. Actually, do yourself a favor and just install XAMPP which does run on Linux (tested on SuSE, RedHat, Mandrake and Debian) and, if you really must use Windows, XAMPP for Windows is just as easy. You'll be able to do perform all the book's exercises fine and you don't have to break your brain pan setting up your web server in the process. JMHO. Once you get past the server set up, you can concentrate on learning the actual coding involved. True to the other books in this series, Head First PHP & MySQL teaches by taking the reader through actually building working features using the technologies involved. In this case, you'll actually learn how to build apps that let visitors to your site fill out forms (though I thought doggie alien abductions was an "interesting" first topic, compared to the expected gaming and rock concert examples) and other client-server interactive tasks. The book is so big (812 pages), not just because it contains a great deal of useful information, but because it presents that information in a bunch of different ways, which is typical for the series. As far as PHP and MySQL is concerned, for the newbie, repetition is absolutely required to "get it". It's one thing to kloogie together code so that it sort of works and quite another to be competent by the last page of the book. Is the book juvenile? Is the series juvenile? Well...yes, but that's the point. If you're a very "serious" person or being highly distractable has never been your problem, there are other books out there for you. Try Web Database Applications with PHP & MySQL or better yet, for beginners, take a look at Learning PHP 5 and Learning MySQL. They're both great books and very good teaching resources. If however, you've looked at those books and felt the grim spectre of boredom settling down on your shoulder, ready to paralyze your will to live, then perhaps Beighley and Morrison's Head First PHP & MySQL is the book for you. It's got what it takes to teach the topic and in a way that will keep you engaged. Make it so.