Basic Newbie Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dgny06
Forum Commoner
Posts: 25
Joined: Thu Jun 14, 2007 11:35 pm

Basic Newbie Question

Post 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...
Arawn
Forum Commoner
Posts: 42
Joined: Sat May 05, 2007 6:03 am

Post 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().
Post Reply