PHP Solutions: Dynamic Web Design Made Easy, Second Edition
The second edition of PHP Solutions: Dynamic Web Design Made Easy is a major rewrite of a book that has helped thousands of web designers add dynamic features to their websites using PHP, the most popular server-side technology. All the code has been revised to bring it in line with the latest best practices, using PHP 5.2 and 5.3. The book assumes no previous knowledge of PHP; but instead of wading through endless exercises with little or no practical value, you put PHP to work straight away through 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.
What you'll learn
The second 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, the most popular open source database system
- Creating a database-driven online photo gallery
- Inserting, updating, and deleting records in a database using PHP's MySQL Improved extension (MySQLi) and PHP Data Objects (PDO)
- Formatting and performing calculations with dates in PHP and MySQL
- Working with multiple database tables
- Using foreign key constraints with the InnoDB storage engine in MySQL
- Password-protecting web pages with a user registration system
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.
The second edition of PHP Solutions requires a minimum of PHP 5.2 and MySQL 4.1.
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. Readers with previous experience of PHP and MySQL can pick and choose the projects that interest them most.
Looking for the download files?
Since the book was published, the friends of ED website has been merged with the site of its parent company, Apress. You can download the files from the book's page on the merged site.
What has changed since the first edition?
The new edition of PHP Solutions follows the same structure as the original version, and most of the projects are the same. However, every chapter has been thoroughly revised. In some cases, little remains of the original apart from the title. For example, the code in Chapters 6 (file uploads) and 8 (generating thumbnail images) has been refactored as PHP 5 classes. Chapter 9 (user registration) contains a custom class to check password strengths. Chapter 14 has been expanded to give extensive coverage to the powerful date and time zone classes introduced in PHP 5.2 and 5.3. As a result, coverage of working with multiple database tables and foreign keys has been moved into two new chapters. The new Chapter 16 explains how to use foreign key constraints with InnoDB, the default storage engine in MySQL 5.5.