You are here: Re: Object classes « PHP Programming Language « IT news, forums, messages
Re: Object classes

Posted by Justin Koivisto on 10/20/05 16:04

Python wrote:
> Hi
>
> I need to know how to keep instance of class. For example. I created
> object:
>
> $myObj = new Person();
>
> ok, and then someone wants to go to the links page, and I want to keep
> data which are created in myObj, for exmaple $myObj->age; $myObj->name;
> etc. etc.
>
> I thought about $serMyObj = serialize($myObj) and the put $serMyObj
> data through POST, GET, or sth like that, and then GET it, but what if
> the portal is big and i want to keep 50 objects in one session ?? put
> data to the database and after that get it and every time someone is
> redirecting to the another page, get form database ...
>

I think you answered your own question with this post... Use sessions.
You can serialize your object and store it in a session variable. Then
on the next script, make sure you include all the necessary include
files for the object classes before you unserialize. I'd personally use
sessions with custom handlers to utilize database tables for this, but
sometimes that is overkill and takes more resources.

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация