PHP and MySQL Web Development

( 12 )


PHP & MySQL Web Development teaches the reader to develop dynamic, secure e-commerce Web sites and Web applications. The book shows how to integrate and implement these technologies by following real-world examples and working sample projects. It also covers the related technologies needed to build a commercial Web site such as SSL, shopping carts, and payment systems. The CD includes a Linux distribution, MySQL, PHP4 and utilities for the projects and code listings.

Use ...

See more details below
Available through our Marketplace sellers.
Other sellers (Multimedia Set)
  • All (35) from $1.99   
  • New (3) from $50.00   
  • Used (32) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2009

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: Baltimore, MD

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 ...


PHP & MySQL Web Development teaches the reader to develop dynamic, secure e-commerce Web sites and Web applications. The book shows how to integrate and implement these technologies by following real-world examples and working sample projects. It also covers the related technologies needed to build a commercial Web site such as SSL, shopping carts, and payment systems. The CD includes a Linux distribution, MySQL, PHP4 and utilities for the projects and code listings.

Use MySQL and PHP4—one of the hottest web-application development combinations on the market—to develop your dynamic web site.

The first book to exclusively cover these popular products for the reader.

An intermediate to advanced guide to PHP and MySQL, the free, open-sourced Web development products. Offers coverage of object-oriented Web programming, creating services using SSL and authentication, and other applications. The CD-ROM includes full versions of PHP, MySQL, and Apache for Windows and Linux/Unix systems, several graphics libraries, files containing the code listings in the book, and the entire book in PDF format.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Thousands of web developers have found all the database help they need in PHP and MySQL Web Development. In their new Third Edition, Luke Welling and Laura Thomson update their classic to reflect new enhancements ranging from PHP5’s new object model to MySQL 5’s long-awaited stored procedures.

As before, you’ll find loads of practical sample code (all of it on the accompanying CD-ROM). The authors begin with a crash course on PHP itself: basic syntax, storing and retrieving data from flat file databases, using arrays; working with strings and regular expressions; functions; code reuse; and finally, object-oriented PHP.

One crucial PHP5 enhancement is exception handling: a unified, extensible, object-oriented solution for handling errors. Welling and Thompson cover PHP5 error handling in detail, from basic concepts and control structures through user-defined exceptions.

Next, you’ll master MySQL from the web developer’s point of view. Welling and Thompson introduce mysqli, PHP5’s new library for connecting with MySQL with either object-oriented or procedural syntax. Along the way, you’ll learn how to use MySQL's privilege system to secure your databases more effectively, and how to address the performance issues that arise in web database applications.

You'll find chapter-length coverage of networking, session control, interactions with filesystems and servers, managing dates and times, generating images, debugging, and more. The book’s highlight: seven start-to-finish projects, ranging from content management to email, generating on-the-fly PDFs to connecting with web services. Follow along with these case studies, and you should be ready to write just about anything. Bill Camarda

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

Shows how to combine the PHP scripting language with the MySQL database to produce interactive web sites. The guide provides examples that demonstrate tasks such as authenticating users, constructing a shopping cart, generating PDF documents and images dynamically, sending and managing email, facilitating user discussions, and managing content. Significant attention is paid to the importance of security. The CD-ROM contains PHP 4, MySQL, and Apache source code and binaries. Annotation c. Book News, Inc., Portland, OR (
From the Publisher
“This book by Welling & Thomson is the only one which I have found to be indispensable.The writing is clear and straightforward but never wastes my time.The book is extremely well laid out.The chapters are the right length and chapter titles quickly take you where you want to go.”
–Wright Sullivan, President,A&E
Engineering, Inc., Greer South Carolina

“There are several good introductory books on PHP, but Welling & Thomson is an excellent handbook for those who wish to build up complex and reliable systems. It’s obvious that the authors have a strong background in the development of professional applications and they teach not only the language itself, but also how to use it with good software engineering practices.”
–Javier Garcia, senior telecom engineer,
Telefonica R&D Labs, Madrid

“This book rocks! I am an experienced programmer, so I didn’t need a lot of help with PHP syntax; after all, it’s very close to C/C++. I don’t know a thing about databases, though, so when I wanted to develop a book review engine (among other projects) I wanted a solid reference to using MySQL with PHP. I have O’Reilly’s mSQL and MySQL book, and it’s probably a better pure-SQL reference, but this book has earned a place on my reference shelf…Highly recommended.”
–Paul Robichaux

“The true PHP/MySQL bible, PHP and MySQL Web Development by Luke Welling and Laura Thomson, made me realize that programming and databases are now available to the commoners. Again, I know 1/10000th of what there is to know, and already I’m enthralled.”
–Tim Luoma,

Read More Show Less

Product Details

  • ISBN-13: 9780672326721
  • Publisher: Sams
  • Publication date: 10/20/2004
  • Series: Developer's Library
  • Edition description: Book & CD-ROM
  • Edition number: 3
  • Pages: 946
  • Product dimensions: 7.08 (w) x 8.90 (h) x 1.97 (d)

Meet the Author

Luke Welling and Laura Thomson are co-founders of Tangled Web Design, and recently won the CCH Emerging Technology award for a site they built using PHP. Both are teachers at RMIT University in Melbourne Australia, and have five years web design experience.
Read More Show Less

Read an Excerpt

Chapter 3: Using Arrays

This chapter shows you how to use an important programming construct—arrays. The variables that we looked at in the previous chapters are scalar variables, which store a single value. An array is a variable that stores a set or sequence of values. One array can have many elements. Each element can hold a single value, such as text or numbers, or another array. An array containing other arrays is known as a multidimensional array.

PHP supports both numerically indexed and associative arrays. You will probably be familiar with numerically indexed arrays if you've used a programming language, but unless you use PHP or Perl, you might not have seen associative arrays before. Associative arrays let you use more useful values as the index. Rather than each element having a numeric index, they can have words or other meaningful information.

We will continue developing the Bob's Auto parts example using arrays to work more easily with repetitive information such as customer orders. Likewise, we will write shorter, tidier code to do some of the things we did with files in the previous chapter.

Key topics covered in this chapter include

  • What is an array?

  • Numerically indexed arrays

  • Associative arrays

  • Multidimensional arrays

  • Sorting arrays

  • Further reading

What Is an Array?

We looked at scalar variables in Chapter 1, "PHP Crash Course." A scalar variable is a named location in which to store a value; similarly, an array is a named place to store a set of values, thereby allowing you to group common scalars.

Bob's product list will be the array for our example. In Figure 3.1, you can see a list of three products stored in an array format and one variable, called $products, which stores the three values. (We'll look at how to create a variable like this in a minute.)

Figure 3.1
Bob's products can be stored in an array.

After we have the information as an array, we can do a number of useful things with it. Using the looping constructs from Chapter 1, we can save work by performing the same actions on each value in the array. The whole set of information can be moved around as a single unit. This way, with a single line of code, all the values can be passed to a function. For example, we might want to sort the products alphabetically. To achieve this, we could pass the entire array to PHP's sort() function.

The values stored in an array are called the array elements. Each array element has an associated index (also called a key) that is used to access the element.

Arrays in most programming languages have numerical indexes that typically start from zero or one. PHP supports this type of array.

PHP also supports associative arrays, which will be familiar to Perl programmers. Associative arrays can have almost anything as the array indices, but typically use strings.

We will begin by looking at numerically indexed arrays.

Numerically Indexed Arrays

These arrays are supported in most programming languages. In PHP, the indices start at zero by default, although you can alter this.

Initializing Numerically Indexed Arrays

To create the array shown in Figure 3.1, use the following line of PHP code:

$products = array( "Tires", "Oil", "Spark Plugs" );

This will create an array called products containing the three values given—"Tires", "Oil", and "Spark Plugs". Note that, like echo, array() is actually a language construct rather than a function.

Depending on the contents you need in your array, you might not need to manually initialize them as in the preceding example.

If you have the data you need in another array, you can simply copy one array to another using the = operator.

If you want an ascending sequence of numbers stored in an array, you can use the range() function to automatically create the array for you. The following line of code will create an array called numbers with elements ranging from 1 to 10:

$numbers = range(1,10);

If you have the information stored in file on disk, you can load the array contents directly from the file. We'll look at this later in this chapter under the heading "Loading Arrays from Files."

If you have the data for your array stored in a database, you can load the array contents directly from the database. This is covered in Chapter 10, "Accessing Your MySQL Database from the Web with PHP."

You can also use various functions to extract part of an array or to reorder an array. We'll look at some of these functions later in this chapter, under the heading "Other Array Manipulations."

Accessing Array Contents

To access the contents of a variable, use its name. If the variable is an array, access the contents using the variable name and a key or index. The key or index indicates which stored values we access. The index is placed in square brackets after the name.

Type $products[0], $products[1], and $products[2] to use the contents of the products array.

Element zero is the first element in the array. This is the same numbering scheme as used in C, C++, Java, and a number of other languages, but it might take some getting used to if you are not familiar with it.

As with other variables, array elements contents are changed by using the = operator. The following line will replace the first element in the array "Tires" with "Fuses".

$products[0] = "Fuses";

The following line could be used to add a new element—"Fuse"—to the end of the array, giving us a total of four elements:

$products[3] = "Fuses";

To display the contents, we could type

echo "$products[0] $products[1] $products[2] $products[3]";

Like other PHP variables, arrays do not need to be initialized or created in advance. They are automatically created the first time you use them.

The following code will create the same $products array:

$products[0] = "Tires";
$products[1] = "Oil";
$products[2] = "Spark Plugs";

If $products does not already exist, the first line will create a new array with just one element. The subsequent lines add values to the array.

Using Loops to Access the Array

Because the array is indexed by a sequence of numbers, we can use a for loop to more easily display the contents:

for ( $i = 0; $i<3; $i++ )
 echo "$products[$i] ";

This loop will give similar output to the preceding code, but will require less typing than manually writing code to work with each element in a large array. The ability to use a simple loop to access each element is a nice feature of numerically indexed arrays. Associative arrays are not quite so easy to loop through, but do allow indexes to be meaningful.

Associative Arrays

In the products array, we allowed PHP to give each item the default index. This meant that the first item we added became item 0, the second item 1, and so on. PHP also supports associative arrays. In an associative array, we can associate any key or index we want with each value.

Initializing an Associative Array

The following code creates an associative array with product names as keys and prices as values.

$prices = array( "Tires"=>100, "Oil"=>10, "Spark Plugs"=>4 );

Accessing the Array Elements

Again, we access the contents using the variable name and a key, so we can access the information we have stored in the prices array as $prices[ "Tires" ], $prices[ "Oil" ], and $prices[ "Spark Plugs" ].

Like numerically indexed arrays, associative arrays can be created and initialized one element at a time.

The following code will create the same $prices array. Rather than creating an array with three elements, this version creates an array with only one element, and then adds two more.

$prices = array( "Tires"=>100 );
$prices["Oil"] = 10;
$prices["Spark Plugs"] = 4;

Here is another slightly different, but equivalent piece of code. In this version, we do not explicitly create an array at all. The array is created for us when we add the first element to it.

$prices["Tires"] = 100;
$prices["Oil"] = 10;
$prices["Spark Plugs"] = 4;

Using Loops with each() and list()

Because the indices in this associative array are not numbers, we cannot use a simple counter in a for loop to work with the array. The following code lists the contents of our $prices array:

while( $element = each( $prices ) )
 echo $element[ "key" ];
 echo " - ";
 echo $element[ "value" ];
 echo "<br>";

The output of this script fragment is shown in Figure 3.2.

Figure 3.2
An each statement can be used to loop through arrays.

In Chapter 1, we looked at while loops and the echo statement. The preceding code uses the each() function, which we have not used before. This function returns the current element in an array and makes the next element the current one. Because we are calling each() within a while loop, it returns every element in the array in turn and stops when the end of the array is reached.

In this code, the variable $element is an array. When we call each(), it gives us an array with four values and the four indexes to the array locations. The locations key and 0 contain the key of the current element, and the locations value and 1 contain the value of the current element. Although it makes no difference which you choose, we have chosen to use the named locations, rather than the numbered ones.

There is a more elegant and more common way of doing the same thing. The function list() can be used to split an array into a number of values. We can separate two of the values that the each() function gives us like this...

Read More Show Less

Table of Contents

I Using PHP
1 PHP crash course 11
2 Storing and retrieving data 57
3 Using arrays 79
4 String manipulation and regular expressions 105
5 Reusing code and writing functions 129
6 Object-oriented PHP 157
7 Exception handling 191
II Using MySQL
8 Designing your Web database 205
9 Creating your Web database 217
10 Working with your MySQL database 241
11 Accessing your MySQL database from the Web with PHP 265
12 Advanced MySQL administration 285
13 Advanced MySQL programming 307
III E-commerce and security
14 Running an e-commerce site 323
15 E-commerce security issues 337
16 Implementing authentication with PHP and MySQL 357
17 Implementing secure transactions with PHP and MySQL 379
IV Advanced PHP techniques
18 Interacting with the file system and the server 401
19 Using network and protocol functions 419
20 Managing the date and time 439
21 Generating images 451
22 Using session control in PHP 479
23 Other useful features 495
V Building practical PHP and MySQL projects
24 Using PHP and MySQL for large projects 507
25 Debugging 523
26 Building user authentication and personalization 541
27 Building a shopping cart 579
28 Building a content management system 625
29 Building a Web-based email service 657
30 Building a mailing list manager 695
31 Building Web forums 751
32 Generating personalized documents in portable document format (PDF) 783
33 Connecting to Web services with XML and SOAP 819
VI Appendixes
A Installing PHP and MySQL 867
Read More Show Less

Customer Reviews

Average Rating 4.5
( 12 )
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
Sort by: Showing all of 12 Customer Reviews
  • Anonymous

    Posted October 20, 2004

    scads of example applications

    In open source usage, the book describes a powerful and popular combination of PHP and MySQL to build websites. Each program has several texts devoted solely to it. But it is in the interaction between the two that often developers need assistance on. The book does start with chapters exclusively on explaining PHP, and other chapters on MySQL. In themselves, you might find these to be concise and useful explanations. But the meat of the book is given in several chapters, where each chapter is devoted to making one common application. Like constructing a shopping cart. Or a Web-based email service. These are things that you have surely experienced as a user. Now you get to see how to code them in PHP and MySQL. Which explains some of the book's size. There are 10 chapters in this section. Enough to give you plenty of examples to draw ideas from.

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

    Posted February 19, 2003

    Excellent, Excellent, Excellent

    This book is one of the first programming books I have read cover to cover that didn't leave gaping holes in code and provided end to end examples of how to write good PHP. The only thing this book lacked was the inane amount redundancy that comes with may programming manuals, thanks. You can be just starting out or looking for advances techniques and they are all there. Great read and great desk reference.

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

    Posted January 2, 2003


    It adequately covers PHP, MySQL, and web programming. Many of the chapters are straight forward and brief. Before jumping into this book, it wouldn't hurt to have a basic understanding of relational database systems, html, and a C or Java-like programming language. If you are already familiar with many of these things, you'll find everything you need for working with PHP and MySQL. The book lacks a section on cascading style sheets. Style sheets were used in one or two examples, but I don't think they were explained. Over all it's a pretty decent book.

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

    Posted November 25, 2002

    Mediocre functional guide. Terrible reference

    I bought this book because it's focused on real applications and includes lots of code. I like that it comes with a working shopping cart app. Unfortunately, it doesn't explain some fundamental concepts used in the code, which left me frustrated searching the internet for answers. Not something I should have to do after spending $40 on a book. Also, the index is pathetic. There are some basic functions not listed. Do yourself a favor - spend the extra 10 bucks and get a programming bible you'll be able to refer to later.

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

    Posted January 5, 2003

    yet another good book by Sams

    Excellent, down to the bone with examples, and explainations. I would recommend to anyone.

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

    Posted August 12, 2002


    This book was absolutely perfect. I am new to databases and E-commerce. I was almost afraid to pay the price for this book, thinking that it would be written in Greek like all of the other books I've purchased on the subject. It was easy to read and VERY EASY to understand.

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

    Posted July 17, 2002

    I've never purchased a better programming book

    I purchased this book to aide in a college project that I was working on. I was assigned to handle the PHP aspects of the project and make it interface with a MySQL database (I had never worked with PHP or MySQL before). This book proved to be the most informative, easiest to follow, and had the best examples of any other computer related book I have ever purchased. The text is VERY easy to follow!

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

    Posted June 17, 2001

    GET THIS BOOK NOW!!!!!!!!!!!!

    Great book. You have to weed through alot of books (wrox) to get to quality. <P> this book has a lot of great information on how to do things not things the author wants to do. It's great book for someone who is starting out in both PHP and mySQL but has more advanced things too. <P> Most books are written like the author assumes you know everything and is sketchy on things. when you are learning it helps to have some guidance. it comes with a cdrom of the book and apache,mysql and php binaries.You can't go wrong with this book. Hopefully more books like this one will be produced. <P>thanks to the authors, they gave it some thought before putting out the same old stuff.

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

    Posted June 15, 2001

    Don't blame the typos on the authors.

    I¿ve come to expect this from SAMS published works, but I¿ll say it anyway. The editing is absolutely atrocious, even in the first few chapters. (I usually find that errors creep in more frequently toward the middle and end of a book.) Nonetheless, it¿s made a great tutorial and the practicality of the examples is refreshing. Another pleasing aspect of PHP and MySQL Web Development is that it doesn't JUST give you real world applications--it explains them, how to modify them, and how to draft those concepts covered into your own projects. This is an excellent and exhaustive coverage of PHP and MySQL that is accessible to anyone with web development or programming experience.

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

    Posted July 22, 2001

    Great book despite the sloppy editing.

    I agree with other reviews that bemoan the needlessly careless editing of this book. Despite this, the book is an excellent overview of PHP and MySQL with great examples of using these tools in practice. Hopefully, the second edition will have the errors and omissions corrected. (Hey, maybe Sams should give all of us that bought the sloppy first edition a free upgrade!)

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

    Posted June 4, 2001

    It's true this book does Rock

    To be more percise however, this book not only taught me how to program in perl quickly but it simultanously taught me how to access and manipulate MySQL with examples that were so easy to translate into programs that solved my own personal needs. This book is a must have provided your server administrator will allow PHP on the server!

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

    Posted October 11, 2000

    This book rocks

    This is a good book

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 12 Customer Reviews

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