Close MySQL Connection in PHP
Moderator: General Moderators
-
fazalbakhtiar
- Forum Newbie
- Posts: 1
- Joined: Mon Oct 10, 2011 10:34 am
Close MySQL Connection in PHP
Basically i have desktop application which brings records or data from MySQL Database through PHP. i create a config file in PHP and creates a connection to the database there. after that i execute the query on some other PHP page which include the config page. i want to close the database connection after that. i am confused as there may be more than one user with open connection and may be his connection closes or the connection for that user will close?
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Close MySQL Connection in PHP
If you are using mysql_connect() to create the connection it will reuse a existing connection. You can close the connection with mysql_close() but if the user closes the page the connection is probably also closed automatically.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering