This frees the memory that is used to store the results of your query 
(the $result variable in most examples).

Many people leave this out, because PHP does a lot of cleanup for you 
when your script exits. However, it is a good habit to go ahead and free 
your results once you are finished using them. It is never really 
necessary, but imagine if you have an enormous result set that takes a 
great deal of memory, you have many people hitting your site, and you 
have a great deal of logic remaining before your script executes. The 
amount of wasted memory can be significant in some cases, so you can use 
this function to keep the "damage" low.

Happy hacking.


Support @ wrote:

> Based on what you said below, can you describe for me when the 
> mysql_free_result tag should be used, and when it is not necessary? 

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to