Page 1 of 1

Basic Newbie Question

Posted: Thu Jun 14, 2007 11:59 pm
by dgny06
Thanks in advance for your help....

I am assuming from some testing of my own that once you open a database connection on a .php page it stays active even outside of the
"<?PHP .. ?>" tag that it first appears in. I ask because I want to create a connection string in an include file and just call the include at the top of every page that requires a connection. This seems to be the case, but I want to make sure that I am just not getting lucky in my testing.

Thanks again...

Posted: Fri Jun 15, 2007 12:14 am
by Arawn
Once you connect to a database, it stays open till the end of the script or you close it.
From the Manual:

Note: The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close().