Description
Quickly master dynamic, database-driven Web development—no experience necessary!
Even if you’re completely new to PHP, MySQL, and Web database development, this book will guide you through every step of building powerful, database-driven, dynamic Web sites. Direct from the world’s top scripting instructor, Ellie Quigley, PHP and MySQL by Example illuminates every concept with tested code examples, screen shots showing program output, and clear, line-by-line explanations.
Classroom-tested in Ellie Quigley’s Silicon Valley training courses and at Marko Gargenta’s Marakana training company in San Francisco, this book takes you from the simplest PHP scripting and SQL querying techniques all the way to dynamic, database driven Web site construction with PHP and MySQL. From simple fill-in forms to program security and debugging, it’s the only PHP/MySQL book you’ll ever need!
This book covers
- Complete PHP fundamentals, including operators, strings, conditionals, loops, arrays, functions, and more
- PHP QuickStart for more advanced readers—makes you productive with PHP in the space of just fifteen book pages
- Essential Web development techniques, from file handling to validating user input with regular expressions
- Powerful PHP features, including user-defined functions and self-processing PHP Forms
- Day-to-day MySQL administration
- A complete SQL tutorial for creating queries, retrieving data, and writing data with MySQL
- Session management and cookies
- Object Oriented PHP
- Best practices for using PHP and MySQL together
Nearly 100,000 professionals and power users have relied on Ellie Quigley’s books to master scripting languages. With PHP and MySQL by Example, you can, too. And once you’ve become an expert, you’ll turn to this book constantly as your go-to source for reliable answers, solutions, and code.
About the CD-ROM
The CD-ROM contains versions of PHP and MySQL for Windows and UNIX/Linux, plus a comprehensive code library for creating your own sites and database-enabled Web applications, including this book’s powerful Art Gallery case study application.
Table of Contents
Preface xxiii
Acknowledgments xxiv
Chapter 1: Introduction 1
1.1 From Static to Dynamic Web Sites 1
1.2 About PHP 4
1.3 About MySQL 7
1.4 Chapter Summary 11
Chapter 2: Getting Started 13
2.1 The Life Cycle of a Web Page 13
2.2 The Anatomy of a PHP Script 15
2.3 Some Things to Consider 21
2.4 Review 31
2.5 Chapter Summary 37
Chapter 2 Lab 38
Chapter 3: PHP Quick Start 41
3.1 Quick Start, Quick Reference 41
3.2 Chapter Summary 57
Chapter 4: The Building Blocks: Data Types, Literals, Variables, and Constants 59
4.1 Data Types 59
4.2 Variables 70
4.3 Constants 99
4.4 Chapter Summary 104
Chapter 4 Lab 105
Chapter 5: Operators 107
5.1 About PHP Operators and Expressions 107
5.2 Chapter Summary 145
Chapter 5 Lab 146
Chapter 6: Strings 149
6.1 What Is a String? 149
6.2 String Functions 155
6.3 Other String Functions 214
6.4 Chapter Summary 218
Chapter 6 Lab 219
Chapter 7: Conditionals and Loops 221
7.1 Control Structures, Blocks, and Compound Statements 221