HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
An end-to-end guide to building industrial-strength web applications: includes PHP/MySQL source code to three complete web applications.
° Successful Core Series format applied to PHP and MySQL
° Much more than exploring PHP syntax, this book shows developers how to build
real-world, mission-critical web applications - and includes fully-tested source code
to three complete web applications.
° Also shows how to use Oracle and PostgresSQL with PHP: two powerful databases
favored in mission-critical settings.
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.
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.
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 bestor failure at worst. Therefore, this book focuses on a lot of things you might not see covered to the same extent in other booksdesign, testing, and security.
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.
In late 1998, PHP 3.0 was released, leading to a major rewrite of the code and the involvement of two new developersZeev 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 languageyou 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 languagesespecially 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.
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 programmingbefore 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 XMLincluding 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.
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.
Download the Index
file related to this title.