PHP Solutions: Dynamic Web Design Made Easy, Third Edition
Now in its third edition, PHP Solutions: Dynamic Web Design Made Easy has helped thousands of web designers add dynamic features to their websites using PHP, the most popular server-side technology. The book has been completely revised to bring it up to date with PHP 5.6, clarifying explanations, and eliminating errors.
PHP Solutions is a cross between a code cookbook and reference. It's equally suitable for web developers and designers with no previous knowledge of PHP, as well as those who've already gained some experience. You put PHP to work straight away through a series of related projects, such as creating a navigation menu that is automatically updated in every page of a site just by editing a single file. Step-by-step instructions tell you not only what to do, but also explain why, making it easier to adapt the code to suit your own needs.
For newcomers to PHP—and those who feel in need of a refresher—Chapter 3 acts as a crash course in PHP basics. The first half of the chapter gives a high level overview of what you need to know before starting to handle PHP code. The second half goes into more detail, and is intended as a handy reference when you're not sure how a particular feature works.
What you'll learn
The third edition of PHP Solutions covers the following topics:
- Choosing the right software to write PHP code
- Setting up a PHP testing environment on Windows and Mac OS X
- Using server-side includes for easier site maintenance
- Sending input from an online form to your email inbox
- Uploading files through a web page, and assigning them unique names
- Automatically generating thumbnail images
- Reading and writing files
- Designing and creating a database in MySQL or MariaDB
- Creating a database-driven online photo gallery
- Inserting, updating, and deleting database records using PHP's MySQL Improved extension (MySQLi) and PHP Data Objects (PDO)
- Formatting and performing calculations with dates in PHP and MySQL/MariaDB
- Working with multiple database tables
- Using foreign key constraints with the InnoDB storage engine in MySQL and MariaDB
- Password-protecting web pages with a user registration system
Each chapter builds on the knowledge gained from the previous one. If you read them in sequence, by the end of the book you'll have a solid grounding in PHP and MySQL/MariaDB. Readers with previous experience of PHP and MySQL can pick and choose the projects that interest them most.
The third edition of PHP Solutions requires a minimum of PHP 5.4.
What's new in this edition?
The third edition of PHP Solutions follows the same structure as the previous version, but it brings the content up to date with PHP 5.6, which was released in August 2014. Because hosting companies are often slow to upgrade the version of PHP that they offer, I’ve made PHP 5.4 the minimum version for the code used in this book. PHP 5.4 made some important changes, introducing a simplified array syntax and dropping support for safe mode and “magic quotes”.
The biggest changes are to the custom classes for uploading files and creating image thumbnails in Chapters 6 and 8. They now use namespaces to avoid naming clashes with other third-party code. More important, the class definitions have been extensively rewritten to make them more efficient. Another significant change is the use of the new password hashing functions in Chapters 9 and 17. These functions weren’t introduced until PHP 5.5, but the book explains how to emulate them in PHP 5.4 by including the
password_compat library in your scripts.
The chapters on working with a database have been reorganized to make them easier to follow. I’ve also strengthened the explanation of prepared statements, using both MySQL Improved (MySQLi) and the database-neutral PHP Data Objects (PDO).