Contents
Introduction 1
Who Should Read This Book? ..............................................................1
What Is PHP? ..........................................................................................1
What Is MySQL? ....................................................................................2
Why Use PHP and MySQL? ..................................................................2
Some of PHP’s Strengths ........................................................................3
Performance ......................................................................................3
Database Integration ..........................................................................3
Built-In Libraries ..............................................................................4
Cost ....................................................................................................4
Learning PHP ....................................................................................4
Portability ..........................................................................................4
Source Code ......................................................................................4
Some of MySQL’s Strengths ..................................................................4
Performance ......................................................................................5
Low Cost ..........................................................................................5
Ease of Use ........................................................................................5
Portability ..........................................................................................5
Source Code ......................................................................................5
How Is This Book Organized? ..............................................................5
What’s New in PHP Version 4? ..............................................................6
Finally ....................................................................................................6
PART I Using PHP 7
1 PHP Crash Course 9
Using PHP ............................................................................................11
Sample Application: Bob’s Auto Parts ................................................11
The Order Form ..............................................................................11
Processing the Form ........................................................................13
Embedding PHP in HTML ..................................................................13
Using PHP Tags ..............................................................................14
PHP Tag Styles ................................................................................15
PHP Statements ..............................................................................15
Whitespace ......................................................................................16
Comments ........................................................................................16
Adding Dynamic Content ....................................................................17
Calling Functions ............................................................................18
The date() Function ........................................................................18
00 7842 FM 3/6/01 3:38 PM Page v