Closing Connection
Posted: Thu Jun 14, 2012 1:45 pm
Learning PHP in a class I'm in, I first learnt about closing a database connection (eg. mysqli_close() ).
So I have been using it thoughout most of my pages (the ones that contain PHP anyways) and I wanted to ask, is it necessary to close a connection?
I know Halls in his tutorials never closed them and doing a slight google search, I have read a connection closes at the end of a script anyways. Just curious to see if there is a main reason of closing a mysql connection, is it to open another?
I ask this, as I'm thinking should I bother putting the close connection at the bottom of every script.
So I have been using it thoughout most of my pages (the ones that contain PHP anyways) and I wanted to ask, is it necessary to close a connection?
I know Halls in his tutorials never closed them and doing a slight google search, I have read a connection closes at the end of a script anyways. Just curious to see if there is a main reason of closing a mysql connection, is it to open another?
I ask this, as I'm thinking should I bother putting the close connection at the bottom of every script.