Re: [PHP] mysql_free_result() question

2001-06-25 Thread Richard Lynch

  Do I mysql_free_result the $Query or the $Result? If it's $Result, would
  this be the same as just going unset($Result)?

 mysql_free_result() frees the ressources that the MySQL server allocated
for
 the results of your query. This is in the memory space of the MySQL
server,
 while if you unset($Result), it only frees the MySQL result id (an integer
 if I remember corretly) in the memory space of your script. So, no,
calling
 unset() is not the same to call mysql_free_result().

I could be wrong, and often am :-), but I believe that PHP4 knows about
MySQL resources, and if you don't have any variables capable of accessing
them any more (IE, you did unset($result)), then it's smart enough to do the
mysql_free_result for you...

This is, however, no excuse for you not writing less sloppy code in the
first place, now that you are educated enough to know what you are doing.
:-)  Use mysql_free_result() if the memory de-allocation is important to
you.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] mysql_free_result() question

2001-06-23 Thread Kristian Duske

 Do I mysql_free_result the $Query or the $Result? If it's $Result, would
 this be the same as just going unset($Result)?

mysql_free_result() frees the ressources that the MySQL server allocated for
the results of your query. This is in the memory space of the MySQL server,
while if you unset($Result), it only frees the MySQL result id (an integer
if I remember corretly) in the memory space of your script. So, no, calling
unset() is not the same to call mysql_free_result().

Hope this helps.
Kristian


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_free_result() question

2001-06-23 Thread Jakob Kruse

You should call mysql_free_result($Query) !!

It all becomes a little clearer if you change the names of the variables as
such:

$result = mysql_query(select ...);
$row = mysql_fetch_assoc($result);

That is, mysql_query() returns a result, and mysql_fetch_*() returns a
row from such a result. Using mysql_free_result on a row is not advisable.

Also, in my terminology, the query would be the string passed to
mysql_query(), so you could do like this:

$query = select ...;
$result = mysql_query($query);
$row = ...

Regards,
Jakob Kruse

Chris Cameron [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm a bit unclear as to which result it is I use this function on.
 So lets say I;
 $Query = mysql_query(SELECT something FROM here);
 $Result = mysql_fetch_assoc($Query);

 Do I mysql_free_result the $Query or the $Result? If it's $Result, would
 this be the same as just going unset($Result)?

 Thanks,
 Chris

 --
 If you don't find it in the index, look very carefully through the entire
catalogue.
 - Sears, Roebuck, and Co., Consumer's Guide, 1897




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]