... your Web site, you must install a Web
server, PHP, and MySQL. PHPandMySQL are free to download and use.
Installing the Web server
After you set up the computer, you need to install a Web server. ... the database. You need to create and administer MySQL
databases.
✦ PHPandMySQL as a pair: In this book, you use PHPand MySQL
together, as a team. PHP can access MySQL by using simple built-in
functions. ... over to the PHPandMySQLWeb sites and sign up for a list or two at
www .php. net/mailing-lists .php and http://lists .mysql. com.
In addition, if you’re developing on your local computer and uploading...
... projects and debugging, and pro-
vides sample projects that demonstrate the power and versatility of PHPand MySQL.
Finally
We hope you enjoy this book and enjoy learning about PHPandMySQL as ... are a PHP newbie or a veteran in
search of a better desk-side reference, this
one is sure to please!”
—WebDynamic
“The true PHP/ MySQL bible, PHP
andMySQLWeb Development by Luke
Welling and Laura ... Code 530
Using PHP on the Command Line 531
Next 532
V Building Practical PHPand MySQL
Projects
25 Using PHPandMySQL for Large
Projects 535
Applying Software Engineering to Web
Development...
... symbol.These symbols (< ?php and ?>) are called PHP tags.They tell
the web server where the PHP code starts and finishes. Any text between the tags is
interpreted as PHP. Any text outside these ... to understand PHP.
This example illustrates the concept of server-side scripting in a nutshell.The PHP
has been interpreted and executed on the web server, as distinct from JavaScript and
other ... define, PHP sets a large number of its own. An easy way to
obtain an overview of them is to run the phpinfo() command:
phpinfo();
This function provides a list of PHP s predefined variables and constants,...
... V Building Practical PHPandMySQL Projects 457
22 Using PHPandMySQL for Large Projects 459
Applying Software Engineering to Web Development 460
Planning and Running a Web Application Project ... order,
and how much sales tax is payable on the order.
PHP Crash Course
CHAPTER 1
1
PHP CRASH
COURSE
11
FIGURE 1.1
Bob’s initial order form only records products and quantities.
PHPANDMYSQLWEB ... your application.
5
PHPANDMYSQLWEB DEVELOPMENT
Dropping a Whole Database 226
Further Reading 226
Next 226
10 Accessing Your MySQL Database from the Web
with PHP 227
How Web Database Architectures...
... system, and work
our way through the various parts of PHPand MySQL.
We will then discuss aspects of electronic commerce and security as they relate to
building a real-world Web site, and show ... Connecting to Web Services with XML and
SOAP 739
The Problem 739
Understanding XML 740
Understanding Web Services 744
SOAP 744
WSDL 745
00 525x fm 1/24/03 2:56 PM Page xxviii
I
Using PHP
1 PHP Crash ... require() and include() 118
Using require() 119
File Name Extensions and require() 120
PHP Tags and require() 120
Using require() for Web Site Templates 120
Using auto_prepend_file and auto_append_file
125
Using...
... are a PHP newbie or a veteran in
search of a better desk-side reference, this
one is sure to please!”
—WebDynamic
“The true PHP/ MySQL bible, PHP
andMySQLWeb Development by Luke
Welling and Laura ... for-
ward, and examples are clear and step by
step. Before I read it, I knew nothing of
PHP and MySQL. After reading it, I have
the confidence and skill to develop any
complicated Web application.”
—Power ... the
bat. It includes webmail, shopping cart,
session control, and web- forum/weblog
applications as a matter of course, and
begins with a sturdy look at PHP first,
moving to MySQL once the basics...
... Using MySQL
7 Designing Your Web Database 169
8 Creating Your Web Database 181
9 Working with Your MySQL Database 203
10 Accessing Your MySQL Database from the Web with
PHP 223
11 Advanced MySQL ... Control in PHP 413
21 Other Useful Features 429
V Building Practical PHPandMySQL Projects
22 Using PHPandMySQL for Large Projects 439
23 Debugging 455
24 Building User Authentication and Personalization
473
25 ... E-commerce and Security
12 Running an E-commerce Site 261
13 E-commerce Security Issues 273
14 Implementing Authentication with PHP and
MySQL 293
15 Implementing Secure Transactions with PHP and
MySQL...
... require() and include() 118
Using require() 119
File Name Extensions and require() 120
PHP Tags and require() 120
Using require() for Web Site Templates 120
Using auto_prepend_file and auto_append_file
125
Using ... 143
Next 143
6 Object-Oriented PHP 145
Object-Oriented Concepts 145
Classes and Objects 145
Polymorphism 147
Inheritance 147
Creating Classes,Attributes, Operations in PHP 147
Structure of a Class ... 151
Implementing Inheritance in PHP 152
Overriding 153
Multiple Inheritance 154
Designing Classes 155
Writing the Code for Your Class 156
Next 165
II Using MySQL
7 Designing Your Web Database 169
Relational...
... 221
10 Accessing Your MySQL Database from the
Web with PHP 223
How Web Database Architectures Work 224
The Basic Steps in Querying a Database from the Web
227
Checking and Filtering Input Data ... 290
Backing Up General Files 291
Backing Up and Restoring Your MySQL
Database 291
Physical Security 291
Next 292
14 Implementing Authentication with PHP and
MySQL 293
Identifying Visitors 293
Implementing ... 240
11 Advanced MySQL 241
Understanding the Privilege System in Detail 241
The user Table 242
The db and host Tables 243
The tables_priv and columns_priv Tables 244
Access Control: How MySQL Uses...
... Date and Time 379
Getting the Date and Time from PHP 379
Using the date() Function 379
Dealing with Unix Timestamps 381
Using the getdate() Function 382
Validating Dates 382
Converting Between PHP ... 382
Converting Between PHPandMySQL Date Formats
383
Date Calculations 384
Using the Calendar Functions 385
Further Reading 386
Next 386
19 Generating Images 387
Setting Up Image Support in PHP 387
Image ... Your Own Errors 468
Handling Errors Gracefully 468
Next 471
24 Building User Authentication and
Personalization 473
The Problem 473
Solution Components 474
User Identification and Personalization...
... 786
Further Reading 786
VI Appendixes
A Installing PHPandMySQL 789
Running PHP as a CGI Interpreter or Module 790
Installing Apache, PHP, andMySQL Under Unix
790
Binary Installation 790
Source ... 798
Is PHP Support Working? 799
Is SSL Working? 799
Installing Apache, PHP, andMySQL Under Windows
801
Installing MySQL Under Windows 801
Installing Apache Under Windows 805
Installing PHP for ... 704
Next 704
00 525x fm 1/24/03 2:56 PM Page xxvii
B Web Resources 813
PHP Resources 813
MySQL and SQL Specific Resources 815
Apache Resources 815
Web Development 815
Index 817
00 525x fm 1/24/03...
... Introduction
WELCOME TO PHP AND
MYSQL W
EB DEVELOPMENT
.Within its pages, you will find
distilled knowledge from our experiences using PHPand MySQL, two of the hottest
Web development tools around.
In ... book
n
What you will be able to achieve using this book
n
What PHPandMySQL are and why they’re great
n
An overview of the latest features of PHP 4
n
How this book is organized
Let’s get started.
Why ... this book is someone who wants to master PHP and
MySQL for the purpose of building a large or commercial Web site.You might already
be working in another Web development language; if so, this book...
... system, and work
our way through the various parts of PHPand MySQL.
We will then discuss aspects of electronic commerce and security as they relate to
building a real-world Web site, and show ... should
seriously consider using PHPand MySQL.
Some of PHP s Strengths
Some of PHP s main competitors are Perl, Microsoft Active Server Pages (ASP), Java
Server Pages (JSP), and Allaire ColdFusion.
In ... specifically for the Web. Within an
HTML page, you can embed PHP code that will be executed each time the page is vis-
ited.Your PHP code is interpreted at the Web server and generates HTML or...
... sample projects that
demonstrate the power and versatility of PHPand MySQL.
Finally
We hope you enjoy this book, and enjoy learning about PHPandMySQL as much as
we did when we first began ... date and time manipulation, and session
variables.
Part V, “Building Practical PHPandMySQL Projects,” deals with practical real-world
issues such as managing large projects and debugging, and ... II,“Using MySQL, ” discusses the concepts and design involved in using relational
database systems such as MySQL, using SQL, connecting your MySQL database to the
world with PHP, and advanced MySQL...
... need to understand PHP.
This illustrates the concept of server-side scripting in a nutshell.The PHP has been
interpreted and executed on the Web server, as distinct from JavaScript and other client-
side ... 16
Chapter 1 PHP Crash Course
We can also add
n
Comments
Most of the lines in the example are just plain HTML.
Using PHP Tags
The PHP code in the previous example began with < ?php and ended with ... begin with a less than (<) symbol and end
with a greater than (>) symbol.These symbols are called PHP tags that tell the Web
server where the PHP code starts and finishes. Any text between the...