You are in the: Small Business Computing Channelarrow
Small Business Technology
» ECommerce-Guide | Small Business Computing | Webopedia | WinPlanet

ECommerce-Guide to Building a Successful ECommerce Site   News, reviews and practical solutions for your online business  
Home News & Trends Solutions Resources eBiz FAQ Selling on eBay Forums Video Products Glossary About
Advertising & Marketing Technology Affiliate ECommerce Building Secure Payment Processing Web Design Customer Relations


Search
ECommerce-Guide

ECommerce Glossary
Enter a Term:

Free Newsletters
Small Business Tech Daily

Webopedia

You are in: ECommerce-Guide > Solutions > ECommerce Building

ECommerce-Guide Essentials
eBiz FAQ
Everything you need to know to start your own successful e-business.

Selling on eBay
How to make money in the online marketplace.

PayPal Payments and More
What's new in secure payments for your online store.

Shopping Cart Software
Solutions to close, process and track your online sales.



Related Articles
Finding Affiliate Profits Online with Site Build It, Part Two
Finding Affiliate Profits Online with Site Build It
Customer Relationship Management, On the Cheap
Build a CMS for Your E-Commerce Site

ecommerce-guide solutions

Build a CMS for Your E-Commerce Site, Part Three

September 7, 2004


By Peter Zeidman

In this series we've been working through the construction of a Content Management System, for use with an e-commerce Web site.

The foundation has been laid in the form of a PHP class for accessing the database ('dbConnector'), and to kick off this month we'll set up the database itself, and create the first working part of the system.

Creating the Database
The first table we're going to add to our database will store content chucks -- product information or other data -- for display on the Web site. The ability to share information is the most important function of an Web site, and the job of the Content Management System is to make doing this as easy as possible.

Consider your own data requirements, a few important ones spring to mind for most tables:

 Field  Purpose Type
     
ID A unique number given to each item, and the primary key of the table. Integer
Title The title of the item Varchar(300)
Tagline A very short summary of the item Varchar(600)
Section The category to which the item belongs Integer
TheArticle The item itself Text

Before we can create the system itself, we need to create the database to store our information. The code below will set this up if you're using the MySQL database system - users of other systems should modify the commands appropriately.

Copy and paste the following into the MySQL admin tool, or use one of the many free 'client' programs available:


CREATE TABLE`databasename`.`cmsarticles` (
`ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the item',
`title` varchar(200) NULL COMMENT 'The item title',
`tagline` varchar(255) NULL COMMENT 'Short summary of the item',
`section` int(4) NULL DEFAULT 0 COMMENT 'The section of the item',
`thearticle` text NULL COMMENT 'The item itself',
PRIMARY KEY (`ID`)
);

If all has gone according to plan, you should now have a working table in the database. We're now going to create a page to allow you or your staff to enter items into the system.

Creating the editor
First, design a form using the HTML editor of your choice. Create text fields for each database field (excluding ID). An example is below:

 Title:

 Tagline:

 Section:

 Article:

Set the action of the form to be newArticle.php (with the method 'post'), and save this page in a folder called cmsadmin (described in the previous portion of this series). If any of this is unclear, just browse through the attached file at the end of this article. Note that the 'section' field is currently a text box, by the time we've finished it'll be a drop-down list, allowing you to choose a section of the site in which to place the item. Next, we'll create the PHP code to deal with whatever is typed into this form, and save it to the database for later retrieval. The code is on the following page, with explanation beneath.

Continued on Page Two.

Go to page: 1  2  Next  

Tools:
Add ecommerce-guide.com to your favorites
Add ecommerce-guide.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed