Results 1 to 4 of 4

Thread: persisting objects

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    persisting objects

    I'm sure the answer to this is use a session but I thought I would check.

    I have a class that I want to use in a lot of my pages but would like to instantiate it once and use it reapetedly. Is there any way to do this other than a session variable.

    Thanks


    Things I do when I am bored: DotNetable

  2. #2
    That or serialize() the class, store it in a database, then unserialize() it when you get it back.

    Only ways I can think of

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    The class in question is a database connection class which would be needed on most pages (information I omitted in the original post).
    If I haven't got a current connection to mysql then I can't read to or write to the database.


    Things I do when I am bored: DotNetable

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    PHP has the session-independent database connection pooling I think, it would be more efficient than sessions.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width