Good programming style

I have a question(s).

  1. Is it necessary to close the connection mysql_close($conn)?
  2. -//- Call garbage collector mysql_free_result()?

What can happen if you don’t follow these rules?


Answer 1, authority 100%

http://php.net/manual/ru/function.mysql-close.php

http://php.net/manual/ru/function.mysql-free-result .php

On both links, read the last paragraph of the “description” block. I don’t think anyone will say more)

Push:

  1. They should only be used in the “paranoid coding” mode, the first – when the selections return a huge amount of data, the second – when you have a crazy number of connections to the database per unit of time and working with the database is not the main part of the script.
  2. I used the first one when working with a 16-gig base, the second – never.