You are here: Store and retrieve objects on server « PHP Programming Language « IT news, forums, messages
Store and retrieve objects on server

Posted by grossespinne on 08/23/07 20:48

Hello everybody!

Is there an efficient way of storing an instance of a PHP-class on the
server and retrieving it based on its ID? I would need it in an AJAX-
webpage in order to find the server-object corresponding to the HTML-
element that sent the request.

The ideas I have had so far:

- add a static method to each class that registers the instances in an
array indexed by the ID-strings and is called by the constructor of
the class -- thus each object registers itself when it gets
constructed. However this solution does not work, as rerunning the
script that contains the definition of the class deletes the
registered instances.

- store the object in the $_SESSION variable -- this works but I don't
thing it is the right way of doing it

- store the object serialized in a file -- have not tried yet, but I
don't think it would be efficient because I would have to update also
the files every time I add or remove a button/label/... from a page. I
think storing in a database would not be a suitable solution either,
for the same reason.


Any ideas are welcome. I would also appreciate if you could tell me
the proper name of the problem because I am quite sure that I am not
the first one experiencing it.

TIA

 

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

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