Is it necessary to explicitly close a DB connection after executing a query (and other DB operation)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Nope, unless you’re sure you’ve finished communicating with the database for the script run. Even then, you don’t need to close it explicitly at all as PHP does that automatically after your script finishes executing, unless you’re using
mysql_pconnect()to connect to your database.