PHP
  Home arrow PHP arrow Working with MySQL and Sessions to Ser...
Dev Shed Forums 
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

Working with MySQL and Sessions to Serialize Objects in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    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:
      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


    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


       · In this last part of the series, you'll learn how to save serialized objects to...
       · Hi.I'm following this tutorial butmay be I found a mistake.I think that you...
       · Hello friend,I'm glad to know my PHP articles have been useful to you, so I...
       · Thank you very much for everything. Your code is clean and logical. I love it. You...
       · Hi Sig again,Well, I'd like to thank you again for the kind comments on my PHP...
       · The previous tutorial referred to is, presumably, <a...
       · I may be missing something, but including the whole class definition in every file...
       · is there a reason why you don't run mysql_real_escape_string() on the serialized...
       · Hello Lucas,Thank you for your posting your comments on my PHP article. Your...
     

       

    PHP ARTICLES

    - Using Aliases and the Autoload Function with...
    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - 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
    - Sub Classing Exceptions in PHP 5
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




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