mysqli_query () inside mysqli_fetch_assoc () dispense with the use of mysqli_free_result?

1

With the new MySQL class, mysqli , it became necessary to always worry about using mysqli_free_result() after mysqli_query() with SELECT to free memory, however I often use mysqli_query() % within mysqli_fetch_assoc() and in this case I do not have a variable with the result of mysqli_query() .

What I would like to know is if this my procedure can lead to improper use of memory, ie if I really have to make a code to use mysqli_free_result() or not? See example:

With the use of mysqli_free_result() :

$query = "SELECT * FROM .... LIMIT 1";
$result = mysqli_query($conn, $query);
$registro = mysqli_fetch_assoc($result);
mysqli_free_result($result);
mysqli_close($conn);

WITHOUT the use of mysqli_free_result() :

$query = "SELECT * FROM .... LIMIT 1";
$registro = mysqli_fetch_assoc(mysqli_query($conn, $query));
mysqli_close($conn);
</pre>
    
asked by anonymous 14.09.2016 / 13:29

0 answers