Is it necessary to use mysql_free_result() and mysql_close()?

Mysql_close() is used to close the connection to the Database and it is necessary to do so in order not to overload the server.

For few visits, if you leave it, it is not important, but if you have many visits, the server could crash and the typical message appears that there are not enough connections to display the page, or something like that 😉

Mysql_free_result() is used to free the memory used when performing a query, and the same as the above, it depends on the number of visits you have.

Theoretically, the server has techniques to free up memory that is no longer used, but it may not release it on time, and we have a dislike for resource consumption. Imagine that you get to use all the memory and start using the hard disk as swap memory, the system would become very slow

In fact, sometimes I myself forget to include them at the bottom of each page, and when I notice I add it, so it’s better to use a small template page where you include these functions at the bottom of each page.

See also  Prototyping in the web design process
Loading Facebook Comments ...
Loading Disqus Comments ...