I finished reading PHP & MYSQL Novice to Ninja and I recommend it for beginners and intermediate learners of PHP. It is easy to digest, teaches best practices and the code is clean and usable.
Disclaimer: contrary to other book reviews, I did not get a copy for this one. As I found this a remarkable PHP book, I wanted to dedicate a blog post to it.
The author probably can describe best what kind of book this is (source): ” … Just as PHP and MySQL have grown from the young upstarts of the web development world into mature, stable platforms for billion-dollar businesses, this book that I’ve been writing again and again for over a decade has grown up … It’s time to write PHP like the big kids do …”.
Why is this such a good starter for learning PHP?
- This is the 5th edition of what has become a best-seller book on PHP. Each edition has grown in handling more recent PHP versions and ways PHP is used nowadays. It uses a clean MVC (model-view-controller) structure seperating PHP controlling code from HTML view templates. It attacks common security pitfalls and presents the concepts in a logical order. From reading the 4th and 5th editions I can attest that it is a well crafted book.
- Beginnings of OOP: the database code has been rewritten in this edition to use PDO (PHP Data Objects API) which professional PHP developers should use. PDO is like JDBC (Java) or DBI (Perl). It provides a data-access abstraction layer which makes changing from one database server to another easy. PDO works with prepared statements which protect you from SQL-injection attacks. Required is a database-specific PDO driver … but I get sidetracked … ;)
- Code best practices: apart from PDO, we see try/catch blocks, MVC architecture, eye for security practices (for example the use of is_uploaded_file when dealing with file upload forms) and more
- I found the database chapters amazing. Again clear, concise, and teach good practices in design. It is mixed in with the PHP chapters: ch2 gives you some basics about mysql, ch5 explains Relational Database Design, ch6-9 uses it heavily in the building of the internet joke database CMS, ch10 – MySQL Administration and ch11 – Advanced SQL Queries, teach more advanced topics. Plus 3 appendices with MySQL reference material. Even if you are going to use another database product then MySQL, the database intro alone provided in this book is worth spending the money.
- Very practical: this book shows you how to build your first dynamic database driven website, step by step. The examples are very clear. I got some years of experience now so the first 100 or so pages I just gazed over, but the project code still had good insights for me. So even having the basics, this can still be a useful reference to do things the right way.
The Sitepoint podcast interviewed the author some months back about this new 5th edition. To go deeper, I think PHP Master might be a good sequel (I have to read it yet). It explains more advanced topics like OOP, testing, security and APIs.