Beginning PHP, Apache, MySQL Web Development


What is this book about?

PHP, Apache, and MySQL are the three key open source technologies that form the basis for most active Web servers. This book takes you step-by-step through understanding each — using it and combining it with the other two on both Linux and Windows servers.

This book guides you through creating your own sites using the open source AMP model. You discover how to install PHP, Apache, and MySQL. Then you create PHP Web ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (18) from $1.99   
  • New (4) from $58.86   
  • Used (14) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2008

Feedback rating:



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.


Ships from: Chicago, IL

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2008

Feedback rating:


Condition: New

Ships from: fallbrook, CA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2015

Feedback rating:


Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2015

Feedback rating:


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
Sort by
Sending request ...


What is this book about?

PHP, Apache, and MySQL are the three key open source technologies that form the basis for most active Web servers. This book takes you step-by-step through understanding each — using it and combining it with the other two on both Linux and Windows servers.

This book guides you through creating your own sites using the open source AMP model. You discover how to install PHP, Apache, and MySQL. Then you create PHP Web pages, including database management and security. Finally, you discover how to integrate your work with e-commerce and other technologies. By building different types of Web sites, you progress from setting up simple database tables to tapping the full potential of PHP, Apache, and MySQL.

When you’re finished, you will be able to create well-designed, dynamic Web sites using open source tools.

What does this book cover?

Here's what you will learn from this book:

  • How PHP server-side scripting language works for connecting HTML-based Web pages to a backend database
  • Syntax, functions, and commands for PHP, Apache, and MySQL
  • Methods and techniques for building user-friendly forms
  • How to easily store, update, and access information using MySQL
  • Ways to allow the user to edit a database
  • E-commerce applications using these three technologies
  • How to set up user logins, profiles, and personalizations
  • Proper protocols for error handling

Who is this book for?

This book is for beginners who are new to PHP and who need to learn quickly how to create Web sites using open source tools. Some basic HTML knowledge is helpful but not essential.

Read More Show Less

Product Details

  • ISBN-13: 9780764557446
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 3/1/2004
  • Edition number: 1
  • Pages: 720
  • Product dimensions: 7.40 (w) x 9.22 (h) x 1.53 (d)

Meet the Author

Michael “BuzzLY” Glass has been a gladiator in the software/Web site development arena for more than eight years. He has more than ten years of commercial programming experience with a wide variety of technologies, including PHP, Java, Lotus Domino, and Vignette StoryServer. He divides his time between computer programming, playing pool in the APA, and running his Web site at You can usually find him slinking around on the forums, where he is a moderator with the nickname BuzzLY.

Yann “Bunkermaster” Le Scouarnec is the senior developer for Jolt Online Gaming, a British gaming company. He is a moderator at and a developer of open source PHP software for the gaming community. He has also worked for major software corporations as a software quality expert.

Elizabeth Naramore has been programming with computers since a very young age, and, yes, she remembers when software was packaged on cassette tapes. Graduating from Miami University at age 20 with a degree in Organizational Behavior, she found a world of opportunity awaiting her—in corporate marketing. Her first love was always computers, however, and she found herself sucked back to the programming world in 1997 through Web site design and development (once a computer geek, always a computer geek). While she plans to return to Miami to get her Masters in Computer Science, she currently stays busy running several Web sites. Her main focus is in e-commerce and running
Elizabeth has spent the past six years developing Web sites and coordinating all phases of Web site publication and production. She is currently a moderator at, an online help center for PHP. Her other interests include poetry, arts and crafts, camping, and juggling the many demands of career, family, and the “other duties as assigned” that come along in life. She lives in Cincinnati, Ohio, with her husband, beautiful daughter, and a new baby on the way.

Gary “trooper” Mailer. After graduation from university in 1998, Gary worked in a major software house in central London as a quality assurance engineer, and also as the departmental Web developer (using ASP). This gave him a taste of Web development. After a few years, he made the jump into full-time Web development and has not looked back since.
Gary has worked in a few different sectors, including communications (Siemens) and hotels (Hilton), as well as in “traditional” development houses.
He is currently a freelance developer for a European communications company. Gary has been and continues to be an active member of and contributor to the site.

Jeremy “stolzboy” Stolz is a Web developer at Cloverfish Inc. (, a Web development company in Fargo, North Dakota. Jeremy is primarily a PHP/MySQL developer, but he has also worked with many other languages. When not working, he frequents the Internet and tries to keep up his programming skills. He is a contributor to and moderator at He also frequents many other computer-related Web sites to keep his skills sharp and up to date.

Jason “goldbug” Gerner currently spends his days working as a Web developer in Cincinnati and burns free time complaining about lack of support for Web standards and abusing XML. He can often be found lurking in the discussion forums, waiting to chime in with nagging comments about CSS or code efficiency.

Read More Show Less

Table of Contents


Part I: Getting Started.

Chapter 1: Introduction and Installation Configuration.

Part II: Movie Review Web Site.

Chapter 2: Creating PHP Pages.

Chapter 3: Using PHP with MySQL.

Chapter 4: Using Tables to Display Data.

Chapter 5: Form Elements: Letting the User Work with Data.

Chapter 6: Letting the User Edit the Database.

Chapter 7: Validating User Input.

Chapter 8: Handling and Avoiding Errors.

Part III: Comic Book Fan Site.

Chapter 9: Building Databases.

Chapter 10: E-mailing with PHP.

Chapter 11: User Logins, Profiles, and Personalization.

Chapter 12: Building a Content Management System.

Chapter 13: Mailing Lists.

Chapter 14: Online Selling: A Quick Way to E-Commerce.

Chapter 15: Creating a Bulletin Board System.

Part IV: Advanced Users.

Chapter 16: Using Log Files to Improve Your Site.

Chapter 17: Troubleshooting.

Appendix A: Answers to Exercises.

Appendix B: PHP Quick Reference.

Appendix C: PHP Functions.

Appendix D: MySQL Data Types.

Appendix E: MySQL Quick Reference.

Appendix F: Comparison of Text Editors.

Appendix G: Choosing a Third-Party Host.

Appendix H: An Introduction to PEAR.

Appendix I: AMP Installation.


Read More Show Less

First Chapter

Beginning PHP, Apache, MySQL Web Development

By Michael K. Glass Yann Le Scouarnec Elizabeth Naramore Gary Mailer Jeremy Stolz Jason Gerner

John Wiley & Sons

ISBN: 0-7645-5744-0

Chapter One

Building Databases

In previous chapters, you created a very nice movie review Web site, but now the hand-holding is over, my friend. It's time for us to push you out of the nest. In this chapter, you will have the opportunity to create your own databases, and your own Web site.

We show you how to put together a comic book appreciation Web site, but you can certainly take the concepts we teach you and branch off to create that online auction or antique car site you have always dreamed about. We think the comic book appreciation Web site is cooler, but whatever. You do your thing.

In this chapter, we are going to cover the basics of creating your own database. Topics we discuss include:

* Planning the design of your database

* Database normalization

* Creating your database

* Creating and modifying tables in your database

* Building Web pages to access your data with PHP

Getting Started

You have a great idea for a site, right? Excellent. Open up your PHP editor and start coding! Believe it or not, many people approach the creation of a Web site in just this way. You may be tempted to yourself. It is not impossible to create a good site in this manner, but you are seriously handicapping your chances for greatness. Before you begin, you need a plan.

We're not going to tell you how to plan out an entire Web site, complete with charts and maps and business models. That's not what this book is all about. We are going to assume that you or somebody in your company has already done that by reading other great books on business models, attending seminars, reading great articles on the Web, and perhaps even hiring a business consultant who will help you with everything but building the site (because that's what we're going to teach you how to do).

So you have a great idea for a Web site and a plan. What do you suppose is the first step in creating a successful Web application using PHP, Apache, and MySQL? We'll give you a clue: Look at the title of this chapter.

We need to build the database this site will be based on. Don't worry-one of the great things about relational database design is that you don't have to create every table your site will use. You can start with a few, and build on it. As long as you follow the basic principles of good database design, your database should be quite scalable (that is, expandable to any size).

Nam et Ipsa Scientia Potestas Est!

That is, knowledge is power. Very profound words, coming from a man who wore a big, ruffled collar. Francis Bacon coined the phrase 400 years ago, and it still holds true today.

Of course, information is the foundation of knowledge. Knowledge consists of having information available to you and knowing what to do with it. Data is the building blocks-the facts and figures-that we piece together to create useful sets of information.

We must be sure to store this data in an easily accessible place and in a way that allows us to relate that data to any other data fairly easily. We also want to be able to modify or remove each piece of data quickly and efficiently, without disturbing other data. With proper database design, all of this is possible.

Sound like a daunting task? Don't worry. You see, we know a secret that has been kept hidden like the magician's code: Efficient database design is easy. No, really, we promise! You see, most of us computer geeks like to seem invaluable and very intelligent, and it sounds quite impressive to most interviewers to see on a resume "Designed a comprehensive Web site utilizing an RDBMS backend." When you are done with this chapter, you will be able to put that on your resume as well!

What Is a Relational Database?

Let's first cover a few basics of database design. The relational database is a concept first conceived by E. F. Codd of IBM, in 1970. It is a collection of data organized in tables that can be used to create, retrieve, delete, and update that data in many different ways. This can be done without having to reorganize the tables themselves, especially if the data is organized efficiently.

Take a look at the first table that follows. You can see that we have a very simple collection of data consisting of superheroes' aliases and real names, and their superhero ID. Nothing too amazing, of course, but notice how we relate it to the league table that follows it. Each superhero user has a League_ID that corresponds to an ID in the league table. Through this link, or relationship, you can see that Average Man is a member of the Dynamic Dudes League because the ID in the league table matches his League_ID in the superhero table.

At first glance, it may seem silly to create a table with one data column and an ID. Why not just put the league name in the superhero table? Imagine that you had a database of 10,000 superheroes, and 250 of them were in the Dynamic Dudes league. Now imagine that the Superhero Consortium decided to do a reorganization and "Dynamic Dudes" was changed to the "Incredible Team." If the league name were in the superhero table, you would have to edit 250 records to change the value. With the leagues in a separate, related table, you have to change the name in only one place.

That is the key to a relational database. And speaking of keys ...


A key is a column that identifies a row of data. In the superhero table, the first column is a key called "ID," as it is in the league table. In both cases, because they are unique, and in the table of the data they represent, they are called primary keys.

Most of the time, the primary key is a single column, but it is not uncommon to use more than one column to make up a primary key. The important distinction is that for each row, the primary key must be unique. Because of that characteristic, we can use the key to identify a specific row of data.

The primary key must contain the following characteristics:

* They cannot be empty (null).

* They will never change in value. Therefore, a primary key cannot contain information that might change, such as part of a last name (for example, smith807).

* They must be unique. In other words, no two rows can contain the same primary key.

The League_ID column in the superhero table is also a key. It matches the primary key of the league table, but it is in a different, or foreign, table. For this reason, it is called a foreign key. Although not a requirement, many programmers will give the foreign key a name that identifies what table it refers to ("League"), and some identifier that marks it as a key ("_ID"). This, along with the fact that keys are usually numeric, makes it fairly clear which column is the foreign key, if one exists in the table at all.

Keys do not have to be purely numeric. Other common values used as primary keys include Social Security numbers (which contain dashes), e-mail addresses, and ZIP Codes. Any value is valid as a primary key as long as it is guaranteed to be unique for each individual record in the table, and will not change over time.

Keys can enable your tables to be recursive. You might, for example, have a sidekick_ID column in the superhero table that we could link to the ID column in the same table. Sidekicks are heroes, too, you know ...


In order to be related, the two tables need a column they can use to tie them together. The superhero and league tables are related to each other by the League_ID column in the superhero table, and the ID field in the league table. There is no explicit link created in the database; rather, you create the relationship by linking them with a SQL statement:

SELECT * FROM superhero s, league l WHERE s.League_ID = l.ID

In plain English, this statement tells the MySQL server to "select all records from the superhero table (call it 's') and the league table (call it 'l'), and link the two tables by the superhero League_ID column and the league ID column."

There are three types of relationships: one-to-one (1:1), one-to-many (1:M), and many-to-many (M:N). Our previous example is a one-to-many relationship. To figure out what type of relationship the tables have, ask yourself how many superheroes you can have in a league. The answer is more than one, or "many." How many leagues can a superhero belong to? The answer is "one." That is a one-to-many relationship. (Of course, in some universes, a superhero might belong to more than one league. But for our example, our superheroes exhibit league loyalty.)

One-to-many is the most common database relationship. Such 1:1 relationships don't happen often, and a many-to-many relationship is actually two one-to-many relationships joined together with a linking table. We explore that further later in the chapter.

Although they are more rare, here's an example of a one-to-one (1:1) relationship just so you know. Say you have a link between a company and its main office address. Only one company can have that exact address. In many applications, however, the main office address is included in the company table, so no relationship is needed. That's one of the great things about relational database design. If it works for your needs, then there is no "wrong" way to do it.

Referential Integrity

The concept of referential integrity may be a little lofty for a beginner book like this, but we think it is important to touch on this briefly. If your application has referential integrity, then when a record in a table refers to a record in another table (as the previous example did), the latter table will contain the corresponding record. If the record is missing, you have lost referential integrity.

In many cases, this is not disastrous. You might have an article written by an author whose name no longer exists in the author table. You still want to keep the article, so losing the referential integrity between authors and articles is okay. However, if you have an order in your database that can't be related to a customer because the customer was deleted, then you might be hard pressed to figure out where to send the product, and who to charge for it!

There are ways to enforce referential integrity in a MySQL database. However, these concepts and procedures are beyond the scope of this book. If you are interested in obtaining more information about referential integrity and foreign keys, visit


"Database normalization" is one of those big fancy terms that database administrators like to throw around, along with "Boyce-Codd Normal Form," "trivial functional dependency," and "Heisenberg compensator." They aren't really important terms to know to be able to design a good database, but we'll touch on normalization here.

For our purposes, we will simply define normalization as the process of modifying your database table structure so that dependencies make sense, and there is no redundant data. In a moment, we are going to go through this process. The best way to learn is to do!

Designing Your Database

It's time to design your application. This will be a relatively simple application, but it will help you learn important concepts such as normalization and expose you to various SQL commands.

Typically, this is where we would take you through a "Try It Out" section and tell you How It Works. When first designing a database, however, you do not need your computer. All you need is a pad of paper and a pencil. So, go get a pad of paper and a pencil. We'll wait.

Let's draw some tables.

The application you are going to design is a comic book character database. You will store a little bit of information about various characters, such as their alter ego's alias, their real names, the powers they possess, and the location of their lair. (Yes, that's right. I said "lair.")

Creating the First Table

Before we open MySQL and start mucking around with tables, we need to figure out how we are going to store all of the data. For simplicity, let's create one big table with all of the relevant data. You can draw it out on your piece of paper, or if you just can't stay away from your computer, use your favorite spreadsheet program. Copy the information you see in the table that follows.

We'll call that table "zero," because we're not even at the first step yet, and that data is just ugly (from a relational database standpoint).

The first thing you should notice is that there are multiple power columns. What would you do if you had to add a character with more than three powers? You would have to create a new column, and that's not good. Instead, let's combine all the powers into one column, and then separate each power into its own separate row. The other columns are duplicated in these additional rows (so, Clean Freak would have three rows instead of one, each row including a different power in the power column, but the name, address, and so on would remain identical among the three listings). This concept is called atomicity. Each value (cell) is atomic, or has only one item of data.

Let's also create a unique primary key for each character. Yes, you could use the character's name, but remember that a primary key should never be something that could change, and it must be unique. To handle this requirement we'll create an ID column.

Because in this pass we have multiple rows with the same character and the multiple rows are a result of the existence of multiple powers, we'll combine the ID column with the power column to create the primary key. When more than one column makes up the primary key, it is called a composite primary key. We'll mark the primary key columns with an asterisk (*) to highlight them for you.

Your table should look like the one that follows. We'll call this table "one" because it's our first pass at normalizing. (Yes, you are in the middle of a normalization process. We told you it wasn't difficult.)

Looking better, but there is still repeated data in there. In fact, the power column is what is causing the duplicate data. Let's separate out the power column and use a foreign key to relate it to the original table. We will also further normalize the power table so that we get rid of duplicate data. This is pass number "two." See the three tables that follow.

As you can see, we have much less repeated data than we did before. The powers have been separated out, and a link table has been created to link each power to each appropriate character.

It may seem a bit nitpicky, but you still have some duplicate data that you can take care of in the character table. It is quite possible for more than one character to be in the same lair, as is the case with Clean Freak and Soap Stud. Let's create a lair table, and link it to the character table with keys.


Excerpted from Beginning PHP, Apache, MySQL Web Development by Michael K. Glass Yann Le Scouarnec Elizabeth Naramore Gary Mailer Jeremy Stolz Jason Gerner Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & 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 & 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 & 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 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


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & 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 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

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