Page 1 of 1

Close MySQL Connection in PHP

Posted: Mon Oct 10, 2011 10:38 am
by fazalbakhtiar
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?

Re: Close MySQL Connection in PHP

Posted: Tue Oct 11, 2011 5:24 am
by social_experiment
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.