PHP
  Home arrow PHP arrow PHP Datastorage Class
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

PHP Datastorage Class
By: Chris Root
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2005-11-14

    Table of Contents:
  • PHP Datastorage Class
  • Top of the Page
  • Flat Files
  • Getting Data In
  • Getting Data Out

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    PHP Datastorage Class


    (Page 1 of 5 )

    Many websites use databases for storing data for use by web applications. There are situations in which this is not the best solution, however. For light, moderate, or temporary storage requirements, you might prefer to use flat files, session variables, and cookies. This article will describe how to create a class that handle all of these. It is the first of two parts.

    Web applications need data. Getting data in and out of an application with the minimum amount of code can be a challenge, and it can be rather easy to end up with something that is not portable or reusable in any way.

    Many times databases are a natural choice for storing data for use by a web application. If you have ever worked on a site that makes extensive use of a database, however, you likely know the strain it can put on a system. A database isn't always the best solution for light or temporary data storage, so it makes sense to have something else that fits your requirements.

    In this article I will guide you through the design of a data storage class that can meet the needs of a long list of web applications requiring light to moderate or temporary storage requirements.

    Where Will It All Go?

    There are three places we can store data that will be useful to us. These are a flat file, session variables and cookies. The class described here can use all of these. If you were to add some sort of database abstraction class to it, database storage could be used as well.

    This class has been used as the core of a number of different applications so far.

    • A shopping cart.

    • An email and web page hit counter.

    • Storage of temporary customer registration information.

    • A debugger logger for template based pages.

    • A project management system.

    • Multi-page form storage.

    • Data conversion tool.

    There are many more potential uses, and once you finish this article I'm hoping you will have some of your own ideas.

    More PHP Articles
    More By Chris Root


       · A very good article, I like the approach greatly. Also I think that using the...
       · I have found the flat file and session features to be extremely useful in several...
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT