Build an Online Store Today with PayPal, PHP, and MySQL
The days of hiring high-priced specialists to build Web storefronts are gone. Build your own online Web store including inventory management using open source PHP and MySQL. Start selling now!
by Laurence Moroney
December 20, 2004
nce upon a time building a Web front to a store was an enormous task, involving expensive specialists. However, over time, technologies have developed that allow anybody to build their own store, and handle transaction fulfillment through the well-known, open access payment system of PayPal. In this article, you'll build a fictional store that stocks and sells sportswear. You'll need a PHP/MySQL-enabled Web server or site. If you don't have one, don't worryall the details for building your own are in this article. If you don't know any PHP or MySQL, the same article is also a good place to start.
To build the store, you need a database that contains information about the products that you have for sale and their current stock levels.
To build the table for products, use this SQL code:
CREATE TABLE `products` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(100) NOT NULL default '',
`picurl` varchar(100) NOT NULL default '',
`price` decimal(10,0) NOT NULL default '0',
`stockcount` int(11) NOT NULL default '0',
`weight` int(11) NOT NULL default '0',
`category` int(11) NOT NULL default '0',
`detail` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
This creates a table with the following fields:
ID: a unique ID for the product type
Description: a textual description of the product
PicURL: a URL to a picture of the product
Price: the cost of the product
Stockcount: the number of items of this product presently in stock
Weight: how heavy the product it (in pounds), used to calculate shipping
Category: the category of the product (see more on this later)
Detail: a detailed description of the product
Figure 1. The Products Table: This is data in the products table using PHPMY ADMIN.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!