Effortless E-Commerce with PHP and MySQL [NOOK Book]


In this comprehensive guide to creating e-commerce website using PHP and MySQL, renowned author Larry Ullman walks you through every step—designing the visual interface, creating the database, presenting content, generating an online catalog, managing the shopping cart, handling the order and the payment process, and fulfilling the order—always with security and best practices emphasized along the way. Even if you’re an experienced web developer, you’re guaranteed to learn something new. The book uses two ...

See more details below
Effortless E-Commerce with PHP and MySQL

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 43%)$31.99 List Price


In this comprehensive guide to creating e-commerce website using PHP and MySQL, renowned author Larry Ullman walks you through every step—designing the visual interface, creating the database, presenting content, generating an online catalog, managing the shopping cart, handling the order and the payment process, and fulfilling the order—always with security and best practices emphasized along the way. Even if you’re an experienced web developer, you’re guaranteed to learn something new. The book uses two complete e-commerce site examples, with various features and goals, to present the widest possible range of e-commerce scenarios. This fully updated and expanded second edition includes an additional and new payment processing example, and also reflects the latest changes in PayPal’s options and methodologies. There are new chapters on marketing-related tools to improve the site and sales, on adding functionality via Ajax, and on implementing e-commerce functionality using OOP instead of procedural code. Effortless E-Commerce with PHP and MySQL, Second Edition teaches you how to:

  • Think of the customer first, in order to maximize sales and customer satisfaction
  • Create a safe server environment and database
  • Use secure transactions and prevent common vulnerabilities
  • Incorporate different payment gateways
  • Design scalable sites that are easy to maintain
  • Build administrative interfaces
  • Extend both examples to match the needs of your own sites
Read More Show Less

Product Details

  • ISBN-13: 9780321678829
  • Publisher: Pearson Education
  • Publication date: 11/4/2010
  • Series: Voices That Matter
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 384
  • File size: 39 MB
  • Note: This product may take a few minutes to download.

Meet the Author

Larry Ullman is a writer, Web and software developer, trainer, instructor, speaker, and consultant. He has written numerous highly acclaimed books, which have sold over 300,000 copies worldwide in more than 20 languages. As his readers, students, and co-workers attest, Larry’s strength is converting the technical and arcane into something comprehensible and useful.

Read More Show Less

Table of Contents


What is E-Commerce?

About This Book

Technologies Used

Getting Help

What You'll Need

Some Fundamental Skills

A Web Server

And a Bit More

Part One: Fundamentals 1

Chapter 1 Getting Started 2

Identifying Your Business Goals 3

Researching Legal Issues 4

National and International Laws 4

PCI Compliance 6

Choosing Web Technologies 7

Selecting a Web Host 8

Hosting Options 9

My Hosting Recommendation 12

Finding a Good Host 12

Using a Payment System 13

Payment Processors 14

Payment Gateways 15

Which Should You Use? 16

The Development Process 17

Site Planning 18

HTML Design 18

Database Design 19

Programming 21

Testing 22

Going Live 24

Maintaining 24

Improving 25

Chapter 2 Security Fundamentals 26

Security Theory 26

No Web Site Is Secure 27

Maximum Security Isn't the Goal 28

Security for Customers 29

PCI Requirements 31

Server Security 33

Hosting Implications 33

PHP and Web Security 34

Database Security 36

Secure Transactions 38

Common Vulnerabilities 40

Protecting Information 40

Protecting the User 41

Protecting the Site 42

Part Two: Selling Virtual Products 47

Chapter 3 First Site: Structure and Design 48

Database Design 49

Server Organization 52

Connecting to the Database 55

The Coring File 57

The HTML Template 61

Creating the Header 63

Adding Dynamic Functionality to the Header 64

Creating the Footer 66

Adding Dynamic Functionality to the Footer 68

Creating the Home Page 70

Chapter 4 User Accounts 72

Defining Helper Functions 72

Creating Form Inputs 73

Protecting Passwords 77

Redirecting the Browser 79

Registration 81

Creating the Basic Shell 82

Creating the Form 83

Processing the Form 84

Logging In 91

Processing the Form 91

Creating the Form 94

Logging Out 95

Managing Passwords 96

Recovering Passwords 97

Changing Passwords 100

Improving the Security 104

Chapter 5 Managing Site Content 106

Creating an Administrator 106

Adding Pages 107

Creating the Basic Script 108

Adding a WYSIWYG Editor 112

Displaying Page Content 115

Creating category.php 115

Creating page.php 118

Adding PDFs 121

Setting Up the Server 122

Creating the PH P Script 123

Displaying PDF Content 130

Creating pdfs.php 130

Creating view_pdf.php 132

Chapter 6 Using PayPal 136

About PayPal 136

Payment Solutions 138

Payment Buttons 139

Testing PayPal 140

Registering at the PayPal Sandbox 140

Creating Test Accounts 141

Creating a Button 143

Integrating PayPal 145

Updating the Registration Page 145

Creating thanks.php 146

Creating cancel.php 148

Testing the Site 149

Using IPN 150

Enabling IPN 151

Updating the Registration Script 151

Creating the IPN Script 153

Updating the Thanks Script 157

Renewing Accounts 158

Going Live 159

Part Three: Selling Physical Products 161

Chapter 7 Second Site: Structure and Design 162

About the Site 162

What's Being Sold 163

No Customer Registration 164

Implementing MVC 164

Heightened Security 165

Database Design 166

Product Tables 166

Customer Tables 167

The SQL 169

Server Setup 172

Server Organization 172

Customizing the Server Behavior 173

Helper Files 179

Connecting to the Database 179

The Config File 180

The HTML Tem plate 182

Newer MySQL Features 185

Prepared Statements 186

Stored Procedures 188

Chapter 8 Creating a Catalog 192

Preparing the Database 192

Populating the Tables Using SQL 193

Looking at the Stored Procedure Queries 196

Creating Stored Procedures 201

Shopping by Category 204

Creating the PHP Script 204

Creating the View Files 206

Listing Products 210

Creating the PHP Script 210

Creating the View Files 212

Creating the "No Products" View 216

Indicating Availability 217

Showing Sale Prices 219

Updating the Stored Procedure 220

Updating product_functions.inc.php 222

Updating list_products.html 223

Updating list_coffees.html 224

Highlighting Sales 224

Creating the Home Page 225

Creating the Sales Page 227

Chapter 9 Building a Shopping Cart 230

Defining the Procedures 230

Adding Products 232

Removing Products 232

Updating the Cart 232

Fetching the Cart's Contents 233

Defining the Helper Functions 234

Making a Shopping Cart 236

Creating the PHP Script 236

Creating the Views 240

Making a Wish List 244

Creating the PHP Script 244

Creating the Views 245

Calculating Shipping 247

Chapter 10 Checking Out 250

About Authorize.net 252

Creating a Test Account 252

Preparing the Site 253

The New HTML Template 253

The Helper Function 255

Creating the Procedures 259

Taking the Shipping Information 266

Creating the PHP Script 267

Creating the View Files 274

Taking the Billing Information 282

Creating the Basic PHP Script 283

Creating the View File 284

Validating the Form Data 288

Processing Credit Cards 294

Creating gateway_setup.php 294

Defining gateway_process.php 296

Examining the Server Response 298

Updating billing.php 300

Completing the Order 302

Creating the PHP Script 303

Creating the View File 304

Testing the Site 306

Going Live 307

Chapter 11 Site Administration 308

Setting Up the Server 309

Requiring Authentication 309

Creating a Template 310

Using Superfish 313

Updating create_form_input() 315

Adding Products 316

Adding Non-Coffee Products 316

Adding Coffee Products 325

Adding Inventory 331

Creating Sales 335

Viewing Orders 340

Listing Every Order 341

Viewing One Order 344

Shipping Orders 349

Creating gateway_setup_admin.php 349

Updating view_order.php 350

Index 354

Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


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


  • - 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 1 Customer Reviews
  • Anonymous

    Posted October 16, 2012

    No text was provided for this review.

Sort by: Showing 1 Customer Reviews

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