Solved

Closing database connection after prepared statement

Posted on 2016-10-30
1
57 Views
Last Modified: 2016-10-30
I just wanted to know if it is necessary to close the database connection after using a prepared statement?

Something like:

$stmt->execute();
$stmt->close();
$link->close();

Open in new window

0
Comment
Question by:Black Sulfur
1 Comment
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 41865891
No.  It's never necessary.  The script termination / garbage collection process will close the connection for you.  Examples here:
https://www.experts-exchange.com/articles/11177/PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question