Sams Teach Yourself PHP, MySQL and Apache All in One / Edition 2

Multimedia Set (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 93%)
Other sellers (Multimedia Set)
  • All (14) from $1.99   
  • New (2) from $65.00   
  • Used (12) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$65.00
Seller since 2014

Feedback rating:

(186)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$65.00
Seller since 2014

Feedback rating:

(186)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by

Overview

In just a short time, you can learn how to use PHP, MySQL, and Apache together to create dynamic, interactive websites and applications using the three leading open-source web development technologies.

Using a straightforward, step-by-step approach, each lesson in this book builds on the previous ones, enabling you to learn the essentials of PHP scripting, MySQL databases, and the Apache web server from the ground up.

Regardless of whether you run Linux, Windows, or Mac OS X, the enclosed CD includes a complete starter kit that lets you install all the software you need to set up a stable environment for learning, testing, and production.

Learn how to...

• Install, configure, and set up the PHP scripting language, the MySQL database system, and the Apache Web server

• Get these technologies to work together to create a dynamic, database-backed website

• Interact with MySQL using PHP

• Work with forms and files

• Create a web-based discussion forum or mailing list

• Add a storefront and shopping cart to your site

• Optimize your MySQL databases

• Fine-tune the Apache server's performance

• Restrict access to your applications

• Set up a secure web server

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Three key open source technologies -- Apache, MySQL, and PHP -- integrate splendidly to offer a complete (and free!) solution for building dynamic Web sites. Wouldn’t it be nice if you could learn all three at once -- and learn how to use them together, to solve real problems?

You can. In this book, Julie C. Meloni brings together all three technologies in one well-organized course. Meloni begins by walking you through installing all three packages from the accompanying CD-ROM. Next, she teaches you all the PHP you need to get rolling, from flow control to basic SQL. In Part III, you’ll learn how to work with forms, files, dates, times, and sessions, and restrict access to your applications.

Meloni then walks you through building four common PHP applications: mailing lists, online address books, storefronts, and shopping cart mechanisms. In the book’s final three hour-long lessons, you’ll learn to tune both Apache and MySQL, and take a closer look at securing Apache.

If you know how to build static web sites with HTML, you have all the background you need to succeed with this book. And if you’ve ever programmed or used a database, you’re really in clover. Bill Camarda

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780672326202
  • Publisher: Pearson
  • Publication date: 12/16/2003
  • Edition description: Older Edition
  • Edition number: 2
  • Pages: 616
  • Product dimensions: 7.30 (w) x 9.10 (h) x 1.38 (d)

Meet the Author

Julie C. Meloni is a technical consultant who has been developing web-based applications since the Web first saw the light of day. She has authored numerous books and articles on web-based programming and scripting languages and database topics, and you can find translations of her work in 18 different languages. She blogs at thickbook.com and nerdtripping.com—the latter reserved for tips and tricks for traveling while nerdy.

Read More Show Less

Table of Contents

Introduction 1

PART I: Getting Up and Running

CHAPTER 1: Installation QuickStart Guide with XAMPP 5

Using Third-Party Installation Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Installing XAMPP on Linux/UNIX . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . 6

Installing XAMPP on Windows . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . 8

Installing XAMPP on Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Securing XAMPP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

CHAPTER 2: Installing and Configuring MySQL 15

Current and Future Versions of MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

How to Get MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Installing MySQL on Linux/UNIX . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . 16

Installing MySQL on Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 18

Installing MySQL on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Troubleshooting Your Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Basic Security Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Introducing the MySQL Privilege System. . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

CHAPTER 3: Installing and Configuring Apache 37

Current and Future Versions of Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Choosing the Appropriate Installation Method . . . . . . . . . . . . . . . . . . . . 38

Installing Apache on Linux/UNIX . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 39

Installing Apache on Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Installing Apache on Windows . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . 42

Apache Configuration File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Apache Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Apache-Related Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

Starting Apache for the First Time . . . . . . . . . . . . . . . . . . . . . . . 53

Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

CHAPTER 4: Installing and Configuring PHP 59

Current and Future Versions of PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

Building PHP on Linux/UNIX with Apache . . . . . . . . . . . . . . . . . . . . . . . . . 60

Installing PHP on Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Installing PHP on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

php.ini Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Testing Your Installation . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 65

Getting Installation Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

The Basics of PHP Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 73

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . 74

PART II: PHP Language Structure

CHAPTER 5: The Building Blocks of PHP 75

Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Operators and Expressions . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 85

Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

CHAPTER 6: Flow Control Functions in PHP 99

Switching Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Code Blocks and Browser Output . . . . . . . . . . . . . . . . . . . . . . . . . 114

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 116

CHAPTER 7: Working with Functions 119

What Is a Function? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Calling Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Defining a Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Returning Values from User-Defined Functions. . . . . . . . . . . . . . . . 124

Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 125

Saving State Between Function Calls with the static Statement . . . . . . . . . . . . . . . . . . 128

More About Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Testing for the Existence of a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

CHAPTER 8: Working with Arrays 139

What Are Arrays? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Creating Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

Some Array-Related Constructs and Functions . . . . . . . . . . . . . . .. . . . . . . . . . 144

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

CHAPTER 9: Working with Objects 149

Creating an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

Object Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 157

PART III: Getting Involved with the Code

CHAPTER 10: Working with Strings, Dates, and Time 159

Formatting Strings with PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

Investigating Strings in PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Manipulating Strings with PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Using Date and Time Functions in PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Other String, Date, and Time Functions . . . . . . . . . . . . . . . . . . . . . . . . 186

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

CHAPTER 11: Working with Forms 189

Creating a Simple Input Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Accessing Form Input with User-Defined Arrays . . . . . . . . . .. . . . . . . . . 191

Combining HTML and PHP Code on a Single Page . . . . . . . . . . . . . . 194

Using Hidden Fields to Save State. . . . . . . . . . . . . . . . . . . .. . . . . . 197

Redirecting the User. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Sending Mail on Form Submission . . . . . . . . . . . . . . . . .. . . . . . . . . . 200

Creating the Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 201

Creating the Script to Send the Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

Working with File Uploads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 210

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

CHAPTER 12: Working with Cookies and User Sessions 213

Introducing Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

Setting a Cookie with PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

Deleting a Cookie with PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

Session Function Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . 217

Starting a Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

Working with Session Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

Destroying Sessions and Unsetting Variables . . . . . . . . . . . . . . . . . .. . . . . . . . 223

Using Sessions in an Environment with Registered Users . . . . . . . . . . . . 224

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 225

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 226

CHAPTER 13: Working with Files and Directories 229

Including Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Using include_once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

Validating Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

Creating and Deleting Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . 238

Opening a File for Writing, Reading, or Appending . . . . . . . . . . . . . . . . . . . . . . . 238

Reading from Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

Writing or Appending to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Working with Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

Opening Pipes to and from Processes Using popen() . . . . . . . . . . .. . . . . . . 251

Running Commands with exec() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

Running Commands with system() or passthru() . . . . . . . . . . . . .. . . . . . 255

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 258

CHAPTER 14: Working with Images 261

Understanding the Image-Creation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

Necessary Modifications to PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

Drawing a New Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 263

Modifying Existing Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

Image Creation from User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

Using Images Created by Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 281

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

PART IV: PHP and MySQL Integration

CHAPTER 15: Understanding the Database Design Process 283

The Importance of Good Database Design . . . . . . . . . . . . . . . . . . . . . . . . . 283

Types of Table Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Understanding Normalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

Following the Design Process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 294

CHAPTER 16: Learning Basic SQL Commands 297

Learning the MySQL Data Types . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 298

Learning the Table-Creation Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

Using the INSERT Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

Using the SELECT Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304

Using WHERE in Your Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 308

Selecting from Multiple Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

Using the UPDATE Command to Modify Records . . . . . . . . . . . . . . . . . . 316

Using the REPLACE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 319

Using the DELETE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . 320

Frequently Used String Functions in MySQL. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 322

Using Date and Time Functions in MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 346

CHAPTER 17: Using Transactions and Stored Procedures in MySQL 349

What Are Transactions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

What Are Stored Procedures?. . . . . . . . . . . . . . . . . . . . . . . . . .. 353

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

CHAPTER 18: Interacting with MySQL Using PHP 357

MySQL or MySQLi Functions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

Connecting to MySQL with PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358

Working with MySQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 370

PART V: Basic Projects

CHAPTER 19: Managing a Simple Mailing List 373

Developing the Subscription Mechanism. . . . . . . . . . . . . . . . . . . . . . . . . . 374

Developing the Mailing Mechanism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 385

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

CHAPTER 20: Creating an Online Address Book 387

Planning and Creating the Database Tables . . . . . . . . . . . . . . . . . . . . . .. . . . 387

Creating an Include File for Common Functions . . . . . . . . . . . . . . . . . . . . 390

Creating a Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

Creating the Record-Addition Mechanism . . . . . . . . . . . . . . . . . . . . . . .. . . . . . 392

Viewing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398

Creating the Record-Deletion Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . 404

Adding Subentries to a Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . 406

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

CHAPTER 21: Creating a Simple Discussion Forum 417

Designing the Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

Creating an Include File for Common Functions . . . . . . . . . . . . . . .. . . . . . . 418

Creating the Input Forms and Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419

Displaying the Topic List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

Displaying the Posts in a Topic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426

Adding Posts to a Topic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 433

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 434

CHAPTER 22: Creating an Online Storefront 437

Planning and Creating the Database Tables . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 437

Displaying Categories of Items . . . . . . . . . . . . . . . . . . . . . . . 441

Displaying Items. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

CHAPTER 23: Creating a Shopping Cart Mechanism 451

Planning and Creating the Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451

Integrating the Cart with Your Storefront . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 453

Payment Methods and the Checkout Sequence. . . . . . . . . . . . . . . . . . . . . . . . . 462

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

CHAPTER 24: Creating a Simple Calendar 467

Building a Simple Display Calendar. . . . . . . . . . . . . . . . . . . . . . . . . . . 467

Creating a Calendar Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . 483

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

CHAPTER 25: Restricting Access to Your Applications 491

Authentication Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Apache Authentication Module Functionality . . . . . . . . . . . . . . . . . . . . . . . . 493

Using Apache for Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497

Combining Apache Access Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

Limiting Access Based on HTTP Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

Restricting Access Based on Cookie Values. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 501

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . 507

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508

CHAPTER 26: Logging and Monitoring Web Server Activity 509

Standard Apache Access Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

Standard Apache Error Logging. . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 515

Managing Apache Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

Logging Custom Information to a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

CHAPTER 27: Application Localization 527

About Internationalization and Localization . . . . . . . . . . . . . . .. . . . . 527

About Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 528

Environment Modifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

Creating a Localized Page Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531

Localizing Your Application with gettext(). . . . . . . . . . . . . . . . . . . . . . . . . 536

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538

CHAPTER 28: Working with XML and JSON 541

What Is XML?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 541

Accessing XML in PHP Using DOM Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 544

Accessing XML in PHP Using SimpleXML Functions . . . . . . . . . . . . . . . . . . . 546

Working with JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 554

PART VI: Administration and Fine-Tuning

CHAPTER 29: Apache Performance Tuning and Virtual Hosting 555

Performance and Scalability Issues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 555

Load Testing with ApacheBench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

Proactive Performance Tuning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561

Preventing Abuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

Implementing Virtual Hosting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 569

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 571

CHAPTER 30: Setting Up a Secure Web Server 573

The Need for Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . 573

The SSL Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574

Obtaining and Installing SSL Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579

Managing Certificates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . 582

SSL Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . 586

CHAPTER 31: Optimizing and Tuning MySQL 589

Building an Optimized Platform . . . . . . . . . . . . . . . . . . . . . . . . .. . 589

Benchmarking Your Database Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590

MySQL Startup Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591

Optimizing Your Table Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593

Optimizing Your Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594

Using the FLUSH Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

Using the SHOW Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603

Q&A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604

CHAPTER 32: Performing Software Upgrades 605

Staying in the Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605

Upgrading MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607

Upgrading Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

Upgrading PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610

CHAPTER 33: Using Application Frameworks 611

Understanding Application Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611

Using the MVC Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612

Installing and Using PHP Application Frameworks . . . . . . . . . . . . . . . . . 614

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617

Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617

Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618

TOC, 9780672335433, 5/2/2012

Read More Show Less

Customer Reviews

Average Rating 3.5
( 7 )
Rating Distribution

5 Star

(2)

4 Star

(0)

3 Star

(4)

2 Star

(1)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 7 Customer Reviews
  • Posted April 27, 2009

    more from this reviewer

    Great for developper

    This book as many Sam's teach yourself is quik teaching and easy for all level starting from beginer to the person want the addvance skills.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 13, 2005

    WARNING!!!!!

    The installation instructions completely fail to mention that PHP5 is not automatically configured with the mySQL libraries. So the first php & mySql integration you try in Chapter 17 will not work if you install it using their instructions. There are a couple of extra installation steps you need to perform to include the mySQL DLLs. This entails customizing the php.ini file and updating your system variables...which is described in the PHP documentation on the Internet. I'm really surprised they failed to mention this.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 11, 2005

    Sloppy - very sloppy

    While the book had content for PHP, MYSql and Apache Web Server, there were numerous typographical errors, some of which affected the understanding of the content. It appears that the author attempted to move from an old edition too quickly, resulting in references within the chapters being incorrect, file names typed wrong, as well a many mispellings. The overview of the book advises that the reader should have a good understanding of the Web and HTML, and the book holds to that with weak or no explanations regarding anything but php. If you can get through that, however, the Chapters are laid out well, with code for all examples on the accompanying disk in case you just can't proof your typing well enough. Also, the install of MySQL, Apache, and PHP in my XP environment went flawlessly. If the next edition has a better proof reader, this could be a 4 star.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted January 12, 2005

    This is the best SAMs book I have ever read.

    Most SAMs Teach Yourself blah blah blah books lack detail, and only tell you what to do. They don't give you any functional uses for it. However, this book does. I highly recommend it for any PHP beginner!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted July 24, 2009

    No text was provided for this review.

  • Anonymous

    Posted October 15, 2010

    No text was provided for this review.

  • Anonymous

    Posted April 29, 2009

    No text was provided for this review.

Sort by: Showing all of 7 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)