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 ?
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 ?
You do not release resources explicitly, but rely on timeouts on the server side and internal housekeeping on the application side.
PHP will close any open connection at the end of the execution. So, nothing happens if you do not put it.
See http://www.php.net/manual/en/function.mysql-close.php
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
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.