PHP
  Home arrow PHP arrow Working with MySQL and Sessions to Serialize Objects in PHP
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? 
Google.com  
PHP

Working with MySQL and Sessions to Serialize Objects in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 13
    2006-06-20


    Table of Contents:
  • Working with MySQL and Sessions to Serialize Objects in PHP
  • The basics of automated object serialization: using objects and sessions
  • Combining objects and sessions: defining a session handling class
  • Another implementation of object serialization: saving objects to MySQL tables
  • The complete list of classes for the example

  • 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


    Working with MySQL and Sessions to Serialize Objects in PHP
    ( Page 1 of 5 )

    If you're interested in learning how to combine objects, sessions and MySQL, this is the article that you’ve been waiting for. It's the final part of the series “Serializing objects in PHP.” In three parts, this series goes through the fundamentals of serializing objects in PHP applications, and explores some advanced topics with regard to this subject, including the use of the magic “__sleep()” and “__wakeup()” functions, and the manipulation of serialized objects inside of MySQL tables.

    Introduction

    If you’ve been reading the previous tutorials, then you’ve hopefully learned the basics of how to serialize/unserialize objects in PHP, as well as how to use the combination of “__sleep()” and “__wakeup()” functions to create objects that are capable of maintaining their state across different web page requests. As you’ll probably recall, these types of objects are called persisting objects, and in general terms, are constructed without the need to use the PHP built-in session handling mechanism.

    Aside from the practical implementation of serialization for building persisting objects, it should be noted that there’s plenty of room to use serialized objects in Web applications, either as part of more advanced programming approaches, or in order to achieve something as simple as storing objects in text files and cookies. Once you’ve mastered the concepts behind object serialization, you can go ahead and develop several applications (an object caching system, to cite an illustrative example), which use serialization for achieving some basic tasks.

    Provided that you’ve already grasped the key concepts about object serialization, in addition to implementing some advanced features, such as the ones I mentioned right at the beginning of this article, in this final installment of the series, I’ll show you some examples of how to work with objects and sessions. I'll also show you how to use MySQL tables to keep your objects safe and healthy.

    So, are you interested in learning how to combine objects, sessions and MySQL? Let’s start exploring this powerful combination.



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - 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 ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek