FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Preserving an object
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Preserving an object [message #174666 is a reply to message #174665] Sat, 25 June 2011 13:37 Go to previous messageGo to previous message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma:
Member
On Jun 25, 8:08 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 6/25/2011 7:06 AM, Jivanmukta wrote:
>
>>> Put it in a separate file and include it?
>
>> IMHO it is not enough. Object should be stored in $_SESSION.
>
> Don't worry about TNP - it's a typical response from him.  He doesn't
> even know the difference between a class and an object.
>
>
>
>
>
>
>
>
>
>> I have similar problem.
>> I tried to solve it this way:
>> File 1:
>> session_start();
>> ...
>> $_SESSION['statement'] = $statement; // object
>
>> File 2:
>> session_start();
>> function __autoload($className) {
>>    require_once 'class.' . strtolower($className) . '.php';
>> }
>> $statement = $_SESSION['statement'];
>
>> but I receive such error:
>
>> object (__PHP_Incomplete_class) #1 (8) {
>>    ["__PHP_Incomplete_Class_Name"] =>  string(9) "Statement" etc.
>
>> Could anybody help me?
>
> You have to have the class file loaded BEFORE starting the session so
> the interpreter knows how to deserialize the $_SESSION object.
>
> P.S. I don't like autoload.  It causes too many problems, like
> performance from having to search multiple directories, or even loading
> the wrong file because someone stuck a file with the same name in
> another directory.  Even changing directory permissions can cause problems.
>
> And, as you see, it doesn't work with sessions.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Well, the object I'm trying to preserve is a database connection. SO,
from reading the above responses, it SEEMS that $_SESSIONs will NOT
work. Bottom line, I can't do it.

Thanks for the responses....

Bruce
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: library using $_SESSION
Next Topic: PHP Function to translate a URL into the URL that it is redirected to
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 19:12:34 GMT 2024

Total time taken to generate the page: 0.03745 seconds