 | Level: Intermediate Tyler Anderson (tyleranderson5@yahoo.com), Engineer, Stexar Corp.
08 Nov 2005 This series chronicles the building of a Web storefront in PHP using PHP Data Objects to access a Derby database. The storefront includes a user manageable shopping cart that allows item purchases using PayPal, and includes the ability for merchants to notify customers via e-mail on successful orders automatically.
In this tutorial
In this tutorial, you prepare for creating a storefront from scratch by setting up a Derby database that houses the information of your storefront. Editing and querying the database is accomplished via PHP data objects (PDOs), as PDOs encapsulate much of the technical and database-specific details on connecting to and executing SQL queries and commands in a database. The owner of our example "Ghastly Computers" has requested an administrative (from here on referred to as "admin") and user entry into the storefront. Adding and editing items via a Web browser makes it easy for administrators anywhere, including the new programmer Ghastly Computers is planning to hire a few states away, to update the content of a storefront and the items contained therein. User sessions will also be introduced to set up the connection between a user and a shopping cart in Part 2 so that, as users move between areas of a storefront, their shopping carts will be carried with them.
Prerequisites
This tutorial assumes basic knowledge of PHP, including if statements, functions, include and require statements, as well as knowledge of variables submitted using GET and POST.
System requirements
You will need to install and test the following tools:
-
Web server
- Pick any Web server and operating system. Feel free to use Apache V2.X, or the IBM HTTP Server.
-
PHP
- Due to the use of PHP data objects, the latest version, PHP V5.1, is necessary to fully follow along. Be sure to configure PHP with the following option to include support for Derby.
-
Database
- This tutorial uses Derby. Download Derby V10.1, the current IBM DB2 JDBC Universal Driver, and the DB2 run-time client from IBM. Be sure to follow the instructions on each page carefully. Follow either the Linux or Windows instructions for downloading and installing the DB2 run-time client.
You may also use Cloudscape. The internals of Cloudscape are the same as Derby. However, the DB2 JDBC Universal Driver and other things are packaged into Cloudscape, and it is supported by IBM. Download Cloudscape V10.1, and the DB2 run-time client from IBM.
-
Java
- Derby requires Java technology. I have found the gcj provided in Red Hat Linux distributions insufficient. Download Java technology from Sun.
Duration
Under two hours
Formats html, pdf
|  | |  |