“PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)” Rough Table of Contents

March 31, 2011

I’m just about finished with Chapter 7 of the fourth edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide”. I thought I’d take this time to finally share the rough version of the Table of Contents (this is actually version 2, as the first version was changed while working on the SQL and MySQL chapters).

In my newsletter, I had presented some of my thoughts as to changes for the fourth edition, and I received a ton of very useful replies. Before showing the TOC, I want to discuss the feedback and how that impacted my plan.

Many people wanted to see more on the Web server (customizing its behavior, using it for extra security, and so forth), which I think is warranted. The best place to put that content is in Appendix A, “Installation.” Not everyone will have the ability or need to tweak the Web server, so the material should’t go in a chapter, and Appendix A discusses server-related stuff in general as is. I’ll try to cover the most important Apache know-how in about 10 pages or so.

People also wanted to see more on databases, JOINs, and complex SQL, which is natural. The previous version of the book had three dedicated chapters on these subjects: Intro to MySQL, Intro to SQL, and Advanced SQL and MySQL. I’m creating a fourth chapter in this edition, in order to expand this area. The Intro to MySQL and Intro to SQL chapters are similar to the previous edition, teaching the basics while using a single table. The new Chapter 6, “Database Design,” covers not just normalization but MySQL-related issues to design: indexes, storage engines, character sets and collations, and foreign key constraints. Some of this is moved from other chapters and some is entirely new to this edition. In the chapter, two normalized, multi-table databases are designed, including one new one. The revamped Chapter 7, “Advanced SQL and MySQL,” takes some of the existing content on JOINs, groupings, FULLTEXT searches, and the like, and adds more on JOINs, a discussion of EXPLAIN, more sophisticated selections (CASE(), COALESCE(), IF(), etc.) plus transactions, database encryption, and so forth. The creation of a second example database in Chapter 6 means I can create more examples, especially of the complex stuff, in Chapter 7.

There was an appropriately mixed reaction to including some Object-Oriented Programming and JavaScript. Both topics are logical ways to expand the book, but both really require oodles of pages to be covered appropriately. Unless you take shortcuts, that is…

The great thing about OOP is that you can reasonably use it without mastering it. The complexity of OOP is in the design process: creating classes of code with methods, attributes, inheritance, access control, etc. The ease of OOP is in using already defined classes. What I’ve decided to do is show how one uses OOP in PHP. Doing so will provide an introduction to OOP without overwhelming the reader or distracting from the other content. And, there are plenty of good OOP classes built into PHP that I can use as examples. One will be the MySQL Improved extension, which the book already demonstrates procedurally (so the OOP coverage will provide a nice comparison). Other candidates include the DateTime class, the Internationalization libraries, and the Standard PHP Library. From this list of candidates, I should be able to put together a nice chapter that both demonstrates how to use OOP, as well as introduces newer features of PHP 5.3 (in fact, some of these classes replicate functionality that was intended for PHP 6, so I can reuse some of the PHP 6 content in a new way).

By comparison, the great, and bad, thing about JavaScript is that people often use it without really knowing it. There’s no way to effectively teach JavaScript in this book, but I can, similar to how I handle OOP, show how to use the jQuery framework. So I’m hoping I can get a chapter in the book on jQuery, probably using it to add dynamic functionality to some of the book’s existing scripts (e.g., form validation inline, Ajax, etc.).

Depending upon space, I may also create a new appendix that discusses “best practices”.

That’s what I’m thinking thus far. These things are always prone to change, even on the fourth edition. Below is the current version of the table of contents. As always, any and all feedback is welcome. And thanks again to those who have already provided some thoughts.

  • Chapter 1: Introduction to PHP
    • Basic Syntax
    • Sending Data to the Web Browser
    • Writing Comments
    • What Are Variables?
    • Introducing Strings
    • Concatenating Strings
    • Introducing Numbers
    • Introducing Constants
    • Single vs Double Quotation Marks
  • Chapter 2: Programming with PHP
    • Creating an HTML Form
    • Handling an HTML Form
    • Conditionals and Operators
    • Validating Form Data
    • Introducing Arrays
    • For and While Loops
  • Chapter 3: Creating Dynamic Web Sites
    • Including Multiple Files
    • Handling HTML Forms, Revisited
    • Making Sticky Forms
    • Creating Your Own Functions
  • Chapter 4: Introduction to MySQL
    • Naming Database Elements
    • Choosing Your Column Types
    • Choosing Other Column Properties
    • Accessing MySQL
  • Chapter 5: Introduction to SQL
    • Creating Databases and Tables
    • Inserting Records
    • Selecting Data
    • Using Conditionals
    • Using LIKE and NOT LIKE
    • Sorting Query Results
    • Limiting Query Results
    • Updating Data
    • Deleting Data
    • Using Functions
  • Chapter 6: Database Design
    • Normalization
    • Creating Indexes
    • Using Different Table Types
    • Languages and MySQL
    • Time Zones and MySQL
    • Foreign Key Constraints
  • Chapter 7: Advanced SQL and MySQL
    • Performing Joins
    • Grouping Selected Results
    • Advanced Selections
    • Performing FULLTEXT Searches
    • Performing Transactions
    • Database Encryption
  • Chapter 8: Error Handling and Debugging
    • Error Types and Basic Debugging
    • Displaying PHP Errors
    • Adjusting Error Reporting in PHP
    • Creating Custom Error Handlers
    • PHP Debugging Techniques
    • SQL and MySQL Debugging Techniques
  • Chapter 9: Using PHP with MySQL
    • Modifying the Template
    • Connecting to MySQL
    • Executing Simple Queries
    • Retrieving Query Results
    • Ensuring Secure SQL
    • Counting Returned Records
    • Updating Records with PHP
  • Chapter 10: Common Programming Techniques
    • Sending Values to a Script
    • Using Hidden Form Inputs
    • Editing Existing Records
    • Paginating Query Results
    • Making Sortable Displays
  • Chapter 11: Web Application Development
    • Sending Email
    • Date and Time Functions
    • Handling File Uploads
    • PHP and JavaScript
    • Understanding HTTP Headers
  • Chapter 12: Cookies and Sessions
    • Making a Login Page
    • Defining the Login Functions
    • Using Cookies
    • Using Sessions
    • Improving Session Security
  • Chapter 13: Security Approaches
    • Preventing Spam
    • Validating Data by Type
    • Validating Files by Type
    • Preventing XSS Attacks
    • Preventing SQL Injection Attacks
  • Chapter 14: Perl-compatible Regular Expressions
    • Creating a Test Script
    • Defining Simple Patterns
    • Using Quantifiers
    • Using Character Classes
    • Finding All Matches
    • Using Modifiers
    • Matching and Replacing Patterns
  • Chapter 15: Introducing jQuery
    • What is jQuery?
    • Incorporating jQuery
    • Selecting Page Elements
    • Event Handling
    • jQuery Effects
    • DOM Manipulation
    • Using Ajax
    • jQuery Plug-Ins
  • Chapter 16: An OOP Primer
    • Fundamentals of OOP
    • Working with MySQL
    • The DateTime Class
    • The Standard PHP Library
    • Applying Internationalization
  • Chapter 17: Example—Message Board
    • Making the Database
    • Writing the Templates
    • Creating the Index Page
    • Creating the Forum Page
    • Creating the Thread Page
    • Posting Messages
  • Chapter 18: Example—User Registration
    • Creating the Templates
    • Writing the Configuration Scripts
    • Creating the Home Page
    • Registration
    • Activating an Account
    • Logging In and Logging Out
    • Password Management
  • Chapter 19: Example—E-Commerce
    • Creating the Database
    • The Administrative Side
    • Creating the Public Template
    • The Product Catalog
    • The Shopping Cart
    • Recording the Orders
  • Appendix A: Installation
    • Installation on Windows
    • Installation on Mac OS X
    • MySQL Permissions
    • Testing Your Installation
    • Configuring PHP
    • Server Configuration
  • Appendix B: Best Practices
    • Comments
    • Optimization