Reply to Re: connection from one page to another

Your name:

Reply:


Posted by ZeldorBlat on 12/06/05 02:08

>Especially a database connection is not something I would store between
>sessions. There is a major chance that the client does not come back
>(every website visitor leaves at SOME point) and you would end up
>keeping connections open that are not used anymore.

You can't store a database connection (well, the resource that is the
link) in a session anyway. Sessions can only store data that is
serializable, of which resources are not. If you have a class for your
database you can define the __sleep() and __wakeup() methods to
open/close the actual link when the object is serialized/unserialized.

If you want to share actual database connections among requests, the
best you can probably do is use mysql_pconnect() instead of
mysql_connect(). pconnect will check for an open link to reuse before
trying to make a new one. At the end of the request the connection is
left open. Be careful though...unless you really have a reason to use
pconnect() I'd stay with plain connect().

[Back to original 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

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