ksmatthews Posted October 10, 2007 Share Posted October 10, 2007 HI Gurus, I am wondering how to set up ONE DB connection once only which can be torn down on leaving a web site. Basically I want my DB connection to remain open across multiple pages without going through the process of setting up and tearing down a new connection for each and every page that will query a DB. I have tried this with '$global DB_connect_id' on one page but it is not visible in other pages ... Any help appreciated, Steven M Link to comment https://forums.phpfreaks.com/topic/72618-database-connectivity-scope/ Share on other sites More sharing options...
trq Posted October 10, 2007 Share Posted October 10, 2007 You can't really make a connection global available. You can however store connections in a pool and reuse them by using mysql_pconnect. This can however seriously effect performance and I wouldn't use it unless you know you need to. Link to comment https://forums.phpfreaks.com/topic/72618-database-connectivity-scope/#findComment-366133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.