Possible Duplicate:
using mysql_close()
Are mysql_close and pg_close required ?
In some script there aren't... why ?
What happen if I don't use its ?
Why don't you read it in the PHP reference manual? All information is there...
But in a nutshell : no they are not necessary, but imho it's better to close the connections yourself to free resources asap when you no longer need them.
If you don't call it, the socket connection to the database remains open for ~30 seconds in a wait state.
If you get lots and lots of people and you don't somehow manage to reuse these zombie connections, your database might explode with a too many users error.
So in answer to your question: syntactically not required but it's very poor practice not to include them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With