Core Web Application Development with PHP and MySQL

Paperback (Print)
Rent
Rent from BN.com
$22.62
(Save 59%)
Est. Return Date: 12/08/2014
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Paperback)
  • All (15) from $1.99   
  • New (6) from $25.74   
  • Used (9) from $1.99   

Overview

The programmer's Guide to building robust web applications with PHP and MySQL

This is a comprehensive, practical guide for programmers who want to develop production-quality, database-enabled web applications with PHP and MySQL. Long-time developer Marc Wandschneider systematically addresses the entire process: not only coding, but also upfront application, user interface and database design, PLUS security, testing, and more.

You'll walk through building three applications from start to finish: a calendaring system, a weblog engine, and an e-commerce store. Along the way, you'll master essential strategies for creating robust web database applications and learn how to avoid the common pitfalls that trip up many developers moving to PHP and MySQL.

  • Starts with a complete primer on PHP for developers including coverage of code organization, reuse, and object-oriented PHP
  • Contains detailed treatments of data access, including transactions, foreign keys, and indexes
  • Presents powerful data validation techniques utilizing PHP regular expressions
  • Walks through planning web applications, including user interfaces and user management
  • Offers systematic guidance on securing web applications from end to end
  • Covers a wide range of implementation issues including internationalization, error handling, data validation, debugging, session management, and deployment
  • Includes detailed chapters on XML, XML-based web services, and the PEAR framework for reusable PHP components
  • Shows how to work with the Oracle and PostgreSQL databases
Read More Show Less

Product Details

  • ISBN-13: 9780131867161
  • Publisher: Prentice Hall
  • Publication date: 9/28/2005
  • Series: Core Series
  • Pages: 888
  • Product dimensions: 6.90 (w) x 9.10 (h) x 1.80 (d)

Meet the Author

Marc Wandschneider has worked extensively with open source platforms, and has written an Outlook Express-style email client for Linux using Qt. He travels the globe, consulting as a lead manager for software projects and teams. A graduate of the McGill University School of Computer Science, he spent five years working for Microsoft, where he developed and managed developers on the Visual Basic, Visual J++, and .NET Windows Forms teams.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Read an Excerpt

Introduction

This is the book I wish I had a couple years ago when I sat down and decided to learn something about web applications. The transition from programming standard window-system GUI applications to writing dynamic web applications was surprisingly complicated. Extremely productive languages such as PHP make the transition easier, but the learning curve remains steep.

With that in mind, I sat down to write this book and explain how to use the various technologies that go into writing web applications. I have made every mistake possible while learning about PHP and databases, and have therefore tried to incorporate as much of what I learned into this book. Far too many books published these days are merely a reprint of existing documentation or UNIX man pages, and I truly wanted to see something different in print.

The technologies, however, are only half the battle. Without strategies or systematic approaches to design and implementation, applications are doomed to an expensive and messy existence at best—or failure at worst. Therefore, this book focuses on a lot of things you might not see covered to the same extent in other books—design, testing, and security.Target Audience

This book is targeted at people who need or want to write a web application. You might be a corporate developer looking to build an intranet application for your company or an Internet web application for customers. You might be a consultant helping a small business develop a web store, or just a hobbyist looking to learn more about web applications and write one of your own.

The assumption is that you have at least a passing familiarity with programming, althoughthis book by no means expects you to be an expert. An understanding of basic programming constructs, such as variables and functions, and a basic understanding of HTML should be more than sufficient.

Because I knew next to nothing about databases when I started learning about web application programming, I likewise expect no more of the reader. This book covers databases from basic terminology and design to basic and advanced queries, with an appropriate balance between clear-and-simple instruction and interesting examples to help you in your development.About PHP

PHP began in 1994 as a series of scripts called PHP/FI (Personal Home Page/Forms Interpreter), and it was written by a fellow named Rasmus Lerdorf to help him manage documents on his web site. Over the years, PHP grew into something more serious. In 1997, a second version of the system came out with additional functionality.

In late 1998, PHP 3.0 was released, leading to a major rewrite of the code and the involvement of two new developers—Zeev Suraski and Andi Gutmans. The goal was to support progressively broader and more complex applications on the web. In early 2000, version 4.0 was released. Based on a new language engine called the Zend Engine, this version had much better performance and increased code modularity. By late 2004, the much-evolved version 5.0 was released. It included many new features, such as new language constructs, broader web server support, sessions, and additional third-party extensions. Among the new language features was a significantly improved and expanded object-oriented programming model, which this book uses extensively. Somewhere along the way, PHP ceased to refer to "Personal Home Page" and came to mean "PHP Hypertext Preprocessor," a so-called recursive acronym. (The acronym actually forms part of the term it defines!)

PHP is a remarkably productive language—you can sit down and crank out (yes, that's the technical term) large amounts of code in a short period of time, and this productivity is what drew me to it some years back. With PHP, I was able to put together surprisingly robust and dynamic travelogues of my journeys to various countries with relatively little code.

The one possible "fly in the ointment" is that the language can be quirky compared to other programming languages—especially if you, like me, come from a background of languages more similar to C/C++, Java, or Visual BASIC. In fact, many of the things covered in this book are the result of my sitting around and scratching my head for a couple of hours. However, after you become comfortable with it, the language proves fun to write and is surprisingly powerful.Layout

This book is divided into six parts, which represents the logical progression of writing web applications.

Part I, "The Basics of PHP," covers the PHP language itself, starting with descriptions and discussions of the most basic types of language. Part I then moves on to functions, code structure, and object-oriented programming—before finishing off with a discussion of arrays and strings.

Part II, "Database Basics," covers databases, starting with terminology and progressing through design and data definition. Part II finishes by describing the use of databases and tables, ranging from the most basic queries to transactions and functions.

Part III, "Planning Web Applications," takes a step back from coding to discuss the design of your web applications. Many people get so involved in writing their code that they forget to sit down and actually think about it in advance. These chapters (hopefully) give you something to think about as you begin. This part also focuses heavily on securing your applications, as it is not something to be taken lightly.

Part IV, "Implementing Your Web Application," discusses the more advanced language features and concepts required to move beyond simple PHP and databases into writing web applications, covering topics such as errors, sessions, and

Part V, "Sample Projects and Further Ideas," presents three full web application samples that start with a simple appointment management system, progress through a web log system, and finish with an ecommerce store. These samples incorporate much of what the book has covered and are designed to be robust. Instead of killing large numbers of trees and listing all the code for the samples, you can download and run them. The book shows you only the most salient sections of the code and leaves you to download and run them in completion.

Part VI, "Appendixes," discusses the installation of the necessary software to run your web applications and how to perform various database actions on different database engines, and suggests some additional reading material.Before You Begin

Before you begin reading the meat of this book, please take a moment to open the CD that accompanies this book and copy the source code to your computer. The phpwasrc/ directory contains the initial files you need.

In addition to the full source code (and installation instructions) for the three large samples from Part V of the book, there are also small snippets of code to accompany many of the chapters in the book. You can run these, debug them, or change and play with them to further help you learn how the language works.

Beyond the sample sources, the CD contains versions of PHP, the Apache HTTP Server, and MySQL that you can use to install the software on your local machine. Instructions are included on the CD.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents

Introduction.

I. THE BASICS OF PHP.

1. Getting Started with PHP.

2. The PHP Language.

3. Code Organization and Reuse.

4. Object-Oriented Programming.

5. Working with Arrays.

6. Strings and Characters of the World.

7. Interacting with the Server: Forms.

II. DATABASE BASICS.

8. Introduction to Databases.

9. Designing and Creating Your Database.

10. Using Databases: Storing and Retrieving Data.

11. Using Databases: Advanced Data Access.

12. PHP and Data Access.

III. PLANNING WEB APPLICATIONS.

13. Web Applications and the Internet.

14. Implementing a User Interface.

15. User Management.

16. Securing Your Web Applications: Planning and Code Security.

17. Securing Your Web Applications: Software and Hardware Security.

IV. IMPLEMENTING YOUR WEB APPLICATION.

18. Error Handling and Debugging.

19. Cookies and Sessions.

20. User Authentication.

21. Advanced Output and Output Buffering.

22. Data Validation with Regular Expressions.

23. XML and XHTML.

24. Files and Directories.

25. File Uploading.

26. Working with Dates and Times.

27. XML Web Services and SOAP.

28. Using PEAR.

29. Development and Deployment.

V. SAMPLE PROJECTS AND FURTHER IDEAS.

30. Strategies for Successful Web Applications.

31. An Appointment Manager.

32. A Blogging Engine.

33. An Ecommerce Application.

VI. APPENDIXES.

Appendix A. Installation/Configuration.

Appendix B. Database Function Equivalents.

Appendix C. Recommended Reading.

Index.

Read More Show Less

Preface

This is the book I wish I had a couple years ago when I sat down and decided to learn something about web applications. The transition from programming standard window-system GUI applications to writing dynamic web applications was surprisingly complicated. Extremely productive languages such as PHP make the transition easier, but the learning curve remains steep.

With that in mind, I sat down to write this book and explain how to use the various technologies that go into writing web applications. I have made every mistake possible while learning about PHP and databases, and have therefore tried to incorporate as much of what I learned into this book. Far too many books published these days are merely a reprint of existing documentation or UNIX man pages, and I truly wanted to see something different in print.

The technologies, however, are only half the battle. Without strategies or systematic approaches to design and implementation, applications are doomed to an expensive and messy existence at best—or failure at worst. Therefore, this book focuses on a lot of things you might not see covered to the same extent in other books—design, testing, and security.

Target Audience

This book is targeted at people who need or want to write a web application. You might be a corporate developer looking to build an intranet application for your company or an Internet web application for customers. You might be a consultant helping a small business develop a web store, or just a hobbyist looking to learn more about web applications and write one of your own.

The assumption is that you have at least a passing familiarity with programming, although this book by no means expects you to be an expert. An understanding of basic programming constructs, such as variables and functions, and a basic understanding of HTML should be more than sufficient.

Because I knew next to nothing about databases when I started learning about web application programming, I likewise expect no more of the reader. This book covers databases from basic terminology and design to basic and advanced queries, with an appropriate balance between clear-and-simple instruction and interesting examples to help you in your development.

About PHP

PHP began in 1994 as a series of scripts called PHP/FI (Personal Home Page/Forms Interpreter), and it was written by a fellow named Rasmus Lerdorf to help him manage documents on his web site. Over the years, PHP grew into something more serious. In 1997, a second version of the system came out with additional functionality.

In late 1998, PHP 3.0 was released, leading to a major rewrite of the code and the involvement of two new developers—Zeev Suraski and Andi Gutmans. The goal was to support progressively broader and more complex applications on the web. In early 2000, version 4.0 was released. Based on a new language engine called the Zend Engine, this version had much better performance and increased code modularity. By late 2004, the much-evolved version 5.0 was released. It included many new features, such as new language constructs, broader web server support, sessions, and additional third-party extensions. Among the new language features was a significantly improved and expanded object-oriented programming model, which this book uses extensively. Somewhere along the way, PHP ceased to refer to "Personal Home Page" and came to mean "PHP Hypertext Preprocessor," a so-called recursive acronym. (The acronym actually forms part of the term it defines!)

PHP is a remarkably productive language—you can sit down and crank out (yes, that's the technical term) large amounts of code in a short period of time, and this productivity is what drew me to it some years back. With PHP, I was able to put together surprisingly robust and dynamic travelogues of my journeys to various countries with relatively little code.

The one possible "fly in the ointment" is that the language can be quirky compared to other programming languages—especially if you, like me, come from a background of languages more similar to C/C++, Java, or Visual BASIC. In fact, many of the things covered in this book are the result of my sitting around and scratching my head for a couple of hours. However, after you become comfortable with it, the language proves fun to write and is surprisingly powerful.

Layout

This book is divided into six parts, which represents the logical progression of writing web applications.

Part I, "The Basics of PHP," covers the PHP language itself, starting with descriptions and discussions of the most basic types of language. Part I then moves on to functions, code structure, and object-oriented programming—before finishing off with a discussion of arrays and strings.

Part II, "Database Basics," covers databases, starting with terminology and progressing through design and data definition. Part II finishes by describing the use of databases and tables, ranging from the most basic queries to transactions and functions.

Part III, "Planning Web Applications," takes a step back from coding to discuss the design of your web applications. Many people get so involved in writing their code that they forget to sit down and actually think about it in advance. These chapters (hopefully) give you something to think about as you begin. This part also focuses heavily on securing your applications, as it is not something to be taken lightly.

Part IV, "Implementing Your Web Application," discusses the more advanced language features and concepts required to move beyond simple PHP and databases into writing web applications, covering topics such as errors, sessions, and XML—including plenty of sample code.

Part V, "Sample Projects and Further Ideas," presents three full web application samples that start with a simple appointment management system, progress through a web log system, and finish with an ecommerce store. These samples incorporate much of what the book has covered and are designed to be robust. Instead of killing large numbers of trees and listing all the code for the samples, you can download and run them. The book shows you only the most salient sections of the code and leaves you to download and run them in completion.

Part VI, "Appendixes," discusses the installation of the necessary software to run your web applications and how to perform various database actions on different database engines, and suggests some additional reading material.

Before You Begin

Before you begin reading the meat of this book, please take a moment to open the CD that accompanies this book and copy the source code to your computer. The phpwasrc/ directory contains the initial files you need.

In addition to the full source code (and installation instructions) for the three large samples from Part V of the book, there are also small snippets of code to accompany many of the chapters in the book. You can run these, debug them, or change and play with them to further help you learn how the language works.

Beyond the sample sources, the CD contains versions of PHP, the Apache HTTP Server, and MySQL that you can use to install the software on your local machine. Instructions are included on the CD.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Average Rating 5
( 2 )
Rating Distribution

5 Star

(2)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted Sat Oct 15 00:00:00 EDT 2005

    comprehensive server side discussion

    The reason for the book's length is that the author is attempting to cover a lot of ground. There are comprehensive and separate descriptions of PHP and MySQL. Keep in mind that each has multiple books devoted to it. The PHP section has a good emphasis on object oriented coding. This can be vital if you have a large PHP code body, for using OO helps code scale to larger sizes. The MySQL section of the text is also nontrivial. Amongst other things, it describes how to design and create a database. Ideas that are largely independent of MySQL, though they can be, and are, implemented in it, in the text. Of course, the main attraction of the book is in combining PHP and MySQL. Here, the book goes into how to make a multitier architecture, from the client side to the database. Chapter 14 on writing the user interface is a little skimpy. But other chapters on the server side issues have more detail on their subjects. Which includes a chapter on XML. Quite aside from PHP or MySQL, knowing how to use XML can be important to you. The book even finds time to cover Web Services and how you might implement and interact with these, using PHP.

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

    Posted Sat Nov 29 00:00:00 EST 2008

    No text was provided for this review.

Sort by: Showing all of 2 Customer Reviews

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