If you can build websites with CSS and JavaScript, this book takes you to the next level—creating dynamic, database-driven websites with PHP and MySQL. Learn how to build a database, manage your content, and interact with users. With step-by-step tutorials, this completely revised edition gets you started with expanded coverage of the basics and takes you deeper into the world of server-side programming.
The important stuff you need to know:
* Get up to speed quickly. Learn how to install PHP and MySQL, and get them running on both your computer and a remote server.
* Gain new techniques. Take advantage of the all-new chapter on integrating PHP with HTML web pages.
* Manage your content. Use the file system to access user data, including images and other binary files.
* Make it dynamic. Create pages that change with each new viewing.
* Build a good database. Use MySQL to store user information and other data.
* Keep your site working. Master the tools for fixing things that go wrong.
* Control operations. Create an administrative interface to oversee your site.
Brett McLaughlin is a bestselling and award-winning non-fiction author. His books on computer programming, home theater, and analysis and design have sold in excess of 100,000 copies. He has been writing, editing, and producing technical books for nearly a decade, and is as comfortable in front of a word processor as he is behind a guitar, chasing his two sons and his daughter around the house, or laughing at reruns of Arrested Development with his wife.
Brett spends most of his time these days on cognitive theory, codifying and expanding on the learning principles that shaped the Head First series into a bestselling phenomenon. He's curious about how humans best learn, why Star Wars was so formulaic and still so successful, and is adamant that a good video game is the most effective learning paradigm we have.
The Missing Credits;
About the Author;
About the Creative Team;
Acknowledgments;
The Missing Manual Series;
Introduction;
What PHP and MySQL Can Do;
What Is PHP?;
What Is MySQL?;
About This Book;
About the Online Resources;
Safari® Books Online;
Part 1: PHP and MySQL Basics;
Chapter 1: PHP: What, Why, and Where?;
1.1 PHP Comes in Two Flavors: Local and Remote;
1.2 PHP: Going Local;
1.3 Write Your First Program;
1.4 Run Your First Program;
1.5 But Where's That Web Server?;
Chapter 2: PHP Meets HTML;
2.1 Script or HTML?;
2.2 PHP Talks Back;
2.3 Run PHP Scripts Remotely;
Chapter 3: PHP Syntax: Weird and Wonderful;
3.1 Get Information from a Web Form;
3.2 Working with Text in PHP;
3.3 The $_REQUEST Variable Is an Array;
3.4 What Do You Do with User Information?;
Chapter 4: MySQL and SQL: Database and Language;
4.1 What Is a Database?;
4.2 Installing MySQL;
4.3 SQL Is a Language for Talking to Databases;
Part 2: Dynamic Web Pages;
Chapter 5: Connecting PHP to MySQL;
5.1 Writing a Simple PHP Connection Script;
5.2 Cleaning Up Your Code with Multiple Files;
5.3 Building a Basic SQL Query Runner;
Chapter 6: Regular Expressions;
6.1 String Matching, Double-Time;
Chapter 7: Generating Dynamic Web Pages;
7.1 Revisiting a User's Information;
7.2 Planning Your Database Tables;
7.3 Saving a User's Information;
7.4 Show Me the User;
7.5 Revisiting (and Redirecting) the Create User Script;
Part 3: From Web Pages to Web Applications;
Chapter 8: When Things Go Wrong (and They Will);
8.1 Planning Your Error Pages;
8.2 Finding a Middle Ground for Error Pages with PHP;
8.3 Add Debugging to Your Application;
8.4 Redirecting On Error;
Chapter 9: Handling Images and Complexity;
9.1 Images Are Just Files;
9.2 Images Are for Viewing;
9.3 And Now for Something Completely Different;
Chapter 10: Binary Objects and Image Loading;
10.1 Storing Different Objects in Different Tables;
10.2 Inserting a Raw Image into a Table;
10.3 Your Binary Data Isn't Safe to Insert...Yet;
10.4 Connecting Users and Images;
10.5 Show Me the Image!;
10.6 Embedding an Image Is Just Viewing an Image;
10.7 So, Which Approach Is Best?;
Chapter 11: Listing, Iterating, and Administrating;
11.1 Thinking about What You Need as an Admin;
11.2 Listing All Your Users;
11.3 Deleting a User;
11.4 Talking Back to Your Users;
11.5 Standardizing on Messaging;
11.6 Integrating Utilities, Views, and Messages;
Part 4: Security and the Real World;
Chapter 12: Authentication and Authorization;
12.1 Basic Authentication;
12.2 Abstracting What's the Same;
12.3 Passwords Don't Belong in PHP Scripts;
12.4 Passwords Create Security, But Should Be Secure;
Chapter 13: Cookies, Sign-Ins, and Ditching Crummy Pop-Ups;
13.1 Moving Beyond Basic Authentication;
13.2 Logging In with Cookies;
13.3 Adding Context-Specific Menus;
Chapter 14: Authorization and Sessions;
14.1 Modeling Groups in Your Database;
14.2 Checking for Group Membership;
14.3 Group-Specific Menus;
14.4 Entering Browser Sessions;
14.5 Memory Lane: Remember That Phishing Problem?;
14.6 Why Would You Ever Use Cookies?;
Part 5: Appendixes;
Installing PHP on Windows Without WAMP;
Installing PHP from www.php.net;
Installing MySQL Without MAMP or WAMP;
Installing MySQL;