emehrkay Posted January 4, 2007 Share Posted January 4, 2007 Just something that crossed my mind.$_SESSION['class'] = new ClassName();and if I wanted to run a method from that session, could I do:$_SESSION['class']->method();?? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2007 Share Posted January 4, 2007 I have not tried it, but it should work. The only restriction is that the class definition must be present before the session_start() -[quote]If you do turn on session.auto_start then you cannot put objects into your sessions since the class definition has to be loaded before starting the session in order to recreate the objects in your session. [/quote] Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 4, 2007 Author Share Posted January 4, 2007 Ill try it later. I didnt even think of that pf Quote Link to comment Share on other sites More sharing options...
effigy Posted January 4, 2007 Share Posted January 4, 2007 An example of this being used is found in [url=http://www.senzalimiti.sk/slgrid/]slGrid[/url]; I've been experimenting with it lately. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 4, 2007 Author Share Posted January 4, 2007 [quote author=effigy link=topic=121008.msg496925#msg496925 date=1167931541]An example of this being used is found in [url=http://www.senzalimiti.sk/slgrid/]slGrid[/url]; I've been experimenting with it lately.[/quote]cool. i just looked through the code and it does exactly what i was thinking about. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 12, 2007 Author Share Posted January 12, 2007 I added solved too soon. It does not workif i do$_SESSION['dbc'] = new dbOjbect(); //that should set my database connection once and store the class as a session varbut when i go to do $_SESSION['dbc']->runQuery($query); i get this crazy errorFatal error: userSQL::login() [<a href='function.userSQL-login'>function.userSQL-login</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "dbObject" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /homepages/sql.php on line 27 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.