Book review: Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition

Full disclosure: I received this ebook free under the O’Reilly Reader Review Programme.

This is a review of Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition by Robin Nixon.

As you can tell by the title this is a big book that covers a lot of material. There is a decent treatment of PHP, MySQL, JavaScript, and CSS within this book. When I came to it I knew nothing about PHP, a little MySQL, a smidgen of JavaScript, and a little bit of CSS and could follow each of the sections without too much difficulty.

The book starts off by looking at the fundamentals of programming (loops, functions, classes etc.) using PHP. To my mind it’s doubtful that anybody who came to this book without these basic concepts would be able to follow the book throughout its entirety without having recourse to other resources- in particular, I don’t think programming with objects can be learned from such humble beginnings. There’s nothing intrinsically wrong with that, but it does make one question whether the rudiments might have been better explained at the level of an amateur (as opposed to novice) programmer just to get the material moving a bit. In my view PHP is not an obvious place to start learning to program because it is very sloppy and quirky but of course all languages have pros and cons for beginners (my first language was R, which is probably an even worse choice of first language).

The first couple of chapters also cover setting up a development environment (a WAMP/ MAMP/ LAMP stack, essentially), there is a slight focus on WAMP/ MAMP (by the book’s own admission) which doesn’t fit my own Linux-based prejudices but you may well be glad of it.

I read this book with a very specific goal in mind, to design and build a database and web frontend for a project at work and this book has been very valuable in that goal. The chapters build nicely, teaching the fundamentals of PHP and MySQL and then exploring how to integrate them, and then looking at enhancing web content using JavaScript, Ajax, and CSS. It does feel a little bit like you are just scratching the surface with CSS because it is such an enormous topic on its own and although I learned a lot of techniques I was left a little unsure as to how to put it all together.

The book also covers important security and login features, such as using cookies to track logged in users, the difference between GET and POST requests, and there is a commendable emphasis on how to avoid SQL/ JavaScript injection, including a couple of functions to help prevent this kind of activity.

The final chapter covers an entire application which uses all of the material from previous chapters (building a rudimentary social networking site) and it was very heartening as a beginner to appreciate just how much can be achieved with a comparatively small amount of code.

This book certainly did what it says on the tin for me and I am using PHP/ MySQL for work as a consequence of having read and used it.

There is one big caveat which is that although it is quite a new book, it does include some deprecated functions. How you feel about this will depend on what you are using the book for and your pre-existing familiarity with PHP/ MySQL and associated technologies. For my part I used the book to get the basic idea of the code, how it fitted together, how to communicate between PHP/ MySQL/ HTML and so on. The inclusion of a few deprecated functions, while not ideal, does not detract from the book for me and I will no doubt come back to my code and update it once I have everything working and having better skills writing and debugging this type of code. If you are quite experienced and want a reference to industry standard programming that you can blast through and put up on a production server the inclusion of deprecated code will be of more concern to you (if you’re this far on the spectrum the book is probably too simple for you anyway, but it illustrates my point about what you’re using the book for).

Overall I would say this book teaches the ecosystem of PHP/ MySQL/ HTML very well and if you wish to learn that ecosystem from a reasonably novice grasp of programming it will serve you well. Absolute beginners and more expert users may wish to look elsewhere.

Leave a Reply