REVIEW - Learning PHP, MySQL & JavaScript - A Step-By-Step Guide to Creating Dynamic Websites

Title:

Learning PHP, MySQL & JavaScript - A Step-By-Step Guide to Creating Dynamic Websites

Author:

Robin Nixon

ISBN:

9781492093824

Publisher:

O’Reilly Media (2021)

Pages:

832

Reviewer:

Ian Bruntlett

Reviewed:

March 2022

Rating:

★★★★☆

Verdict: Recommended

This book is ambitious. The cover blurb promises to provide a “step-by-step guide to creating dynamic websites”. This book will get you started and – despite it being a big book (29 chapters) – is more of an introduction to this vast topic. Within the Preface, the book promises “a thorough grounding in the core technologies of PHP, MySQL, JavaScript, CSS, and HTML5, and you’ll learn the basics of the React library, too”. It does recommend at least a basic understanding of HTML. I’ll review this book chapter by chapter.

‘Introduction to Dynamic Web Content’ does this well, covering PHP, MySQL, JavaScript, CSS, HTML5, Apache (web server) and their interactions.

‘Setting up a Development Server’ recommends and illustrates the use of AMPSS to set a computer as a development machine – however, to quote the author on his GitHub page, “As of 2022, I no-longer recommend the AMPPS web server stack” (because of stability problems) and recommends the use of MAMP (http://mamp.info) instead. Personally, I put my trust in the meta-packages of Ubuntu Linux as it is my preferred way of keeping software properly patched. Finally, it concludes on the role of Code Editors and IDEs.

PHP is covered in the next 5 chapters. ‘Introduction to PHP’ is accessible even to people who haven’t coded before, using a matchbox metaphor to illustrate variables and arrays. ‘Expressions and Control Flow in PHP’ gently introduces its topic, including operator precedence and associativity. Control flow is illustrated using roads as a metaphor. ‘PHP Functions and Objects’ gives a good plain English introduction to functions but for classes it only deals with syntax so making life difficult for a novice coder. It covers the syntax well enough but it could have considered function design, class design, SOLID principles. It wouldn’t have had to cover these topics in detail – just mentioning that they exist and references to suitable websites or books would have been helpful. ‘PHP Arrays’ is straightforward, covering arrays and some of the support that is provided for them – including the occasional reference to online documentation. ‘Practical PHP’ covers some highlights of PHP – printf / sprintf, Date and Time functions, and basic file handling.

‘Introduction to MySQL’ does what it says. While it is a good introduction, it would have benefited from a further reading section. ‘Mastering MySQL’ is an ambitious title. It introduces the reader to database design – covering using normalisation and where not to use it, different types of table relationships, transactions, understanding queries with EXPLAIN as well as backing up and restoring databases. ‘What’s New in PHP 8 and MySQL’ brings this book up to date with technologies which were released while the book was being prepared. ‘Accessing MySQL Using PHP’ introduces the reader to using PDO (PHP Data Objects). PDO can not only access MySQL databases but others as well. It is a bit of a challenging chapter because the main example has to use HTML forms which get covered in the next chapter.

‘HTML Form Handling’ is quite intense, covering the display and server side processing of HTML forms along with the careful sanitsation of user input and HTML5 enhancements.

‘Cookies, Sessions, and Authentication’ covers the use of cookies from PHP, authenticating users using PHP and MySQL.

A large chunk of this book covers JavaScript. ‘Exploring JavaScript’ is a gentle introduction, building on coding experience gained in previous PHP chapters, further developed by ‘Expressions and Control Flow in JavaScript’, ‘JavaScript Functions, Objects, and Arrays’. I found ‘JavaScript and PHP Validation and Error Handling’ to be challenging. It does cover the use of regular expressions for validation – I had to resort to the Internet (especially www.w3schools.com/js/js_regexp.asp) to get a better grasp of things.

‘Using Asynchronous Communication’ is an introduction to the topic, again, further references would have been helpful.

‘Introduction to CSS’, ‘Advanced CSS with CSS3’ treats the topic of CSS with many details, making for dry reading. Coupled with ‘Accessing CSS from JavaScript’, this helps me appreciate the role of front-end developers.

‘Introduction to jQuery’, ‘Introduction to jQuery Mobile’, ‘Introduction to React’ delve even deeper into front-end development. Note – this is a large topic and I have only scratched the surface of it.

‘Introduction to HTML5’ brings the reader up to speed on the new facilities supported. It would have been helpful if an earlier chapter had specified how much HTML knowledge is required before reading this book. HTML5 is discussed widely – with chapters dedicated to HTML5 canvases, audio and video content, rounded off with ‘Other HTML5 features’.

The final chapter, ‘Bringing it all together’, provides a simple social networking project as a final example. I got Andy Burgess, a friend who is experienced in this sort of thing, to look at this project. He found in functions.php the use of a deprecated (and in PHP 8.0 removed) function get_magic_quotes_gpc() and had to remove that call to get the site to work. This has been noted under errata (Unconfirmed errata) on the book’s website.

The author clearly knows a lot about this topic. This book introduces the reader to this topic, building on a kernel of assumed knowledge and experience. Any beginner reading this book will need additional help. It serves to get the studious reader to a certain level of competence. A Bibliography is sorely lacking. At the end of chapters, a short list of questions is presented to the reader with answers at the back of the book – I found this useful for tracking my progress through the book.

Ultimately, this book broadened my understanding of the Apache/MySQL/PHP software stack. It has whetted my appetite for a more comprehensive work on PHP.

Website: https://www.oreilly.com/library/view/learning-php-mysql/9781492093817/