Explain how to close MySQL connection objects.- MySQL connection objects created with mysql_connect() calls can be closed by calling mysql_close($con) function.
- This reduces the consumption of connection resources on your MySQL server.
- The mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier.
- If link_identifier isn't specified, the last opened link is used.
- Open non-persistent MySQL connections and result sets are automatically destroyed when a PHP script finishes its execution.
- So, while explicitly closing open connections and freeing result sets is optional, doing so is recommended.
- This will immediately return resources to PHP and MySQL, which can improve performance.
|