PHP
  Home arrow PHP arrow PHP Datastorage Class
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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: starstarstarstarstar / 10
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT