jcombs_31 Posted April 20, 2006 Share Posted April 20, 2006 I've never really used the mysql_free_result() or mysql_close functions in my scripts. Are they really necessary. Do you guys use them? Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/ Share on other sites More sharing options...
ober Posted April 20, 2006 Share Posted April 20, 2006 I never use them. It's closed automatically for you at the end of script execution, so why bother? Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29009 Share on other sites More sharing options...
jcombs_31 Posted April 20, 2006 Author Share Posted April 20, 2006 [!--quoteo(post=366862:date=Apr 20 2006, 11:39 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Apr 20 2006, 11:39 AM) [snapback]366862[/snapback][/div][div class=\'quotemain\'][!--quotec--]I never use them. It's closed automatically for you at the end of script execution, so why bother?[/quote]that's what I thought, so why even have them? I don't understand the purpose or usage... Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29016 Share on other sites More sharing options...
redbullmarky Posted April 20, 2006 Share Posted April 20, 2006 [!--quoteo(post=366869:date=Apr 20 2006, 04:56 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 20 2006, 04:56 PM) [snapback]366869[/snapback][/div][div class=\'quotemain\'][!--quotec--]that's what I thought, so why even have them? I don't understand the purpose or usage...[/quote]i might be guessing - i actually have mysql_free_result but only cos it's the way i learnt and just stuck with it out of habit - but wouldn't it make all the difference with say, for example, a large script that deals with large tables on a high traffic site? surely freeing up a result would take the load of the server a little? all the manual really states is that its to be used if youre worried about memory when dealing with large results.as for mysql_close - not a clue. Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29063 Share on other sites More sharing options...
ober Posted April 20, 2006 Share Posted April 20, 2006 The only case I could imagine is if you were dealing with more than one DBMS and you wanted to close one and open another. *shrug* I've just never dealt with anything that big (although I might soon at work... they want me to graph some test results with 10Hz data... 2 tests with 12000 records each compared on one graph!) Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29096 Share on other sites More sharing options...
zq29 Posted April 20, 2006 Share Posted April 20, 2006 I think you should be using mysql_close() when opening persistent connections with mysql_pconnect() as I don't [i]think[/i] they close themself... Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29116 Share on other sites More sharing options...
redbullmarky Posted April 20, 2006 Share Posted April 20, 2006 [!--quoteo(post=366969:date=Apr 20 2006, 08:24 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 20 2006, 08:24 PM) [snapback]366969[/snapback][/div][div class=\'quotemain\'][!--quotec--]I think you should be using mysql_close() when opening persistent connections with mysql_pconnect() as I don't [i]think[/i] they close themself...[/quote]according to the manual, it appears that mysql_close is used for non-persistent connections:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Note: mysql_close() will not close persistent links created by mysql_pconnect().[/quote]and[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.[/quote]does make you wonder though, how much coding gets done that isn't that necessary...how many other functions are like this and not required, etc...still. Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29160 Share on other sites More sharing options...
zq29 Posted April 21, 2006 Share Posted April 21, 2006 Oh! Must have got my wires crossed somewhere then - My appologies. Link to comment https://forums.phpfreaks.com/topic/7947-free-result-or-close/#findComment-29274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.