Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Web Design & Development Web Design & Development
Search Search
Search for:
Tech Support Guy > > >

Solved: MySql - When to close the db?


(!)

JiminSA's Avatar
JiminSA   (Jim) JiminSA is offline JiminSA has a Profile Picture
Computer Specs
Member with 1,704 posts.
THREAD STARTER
 
Join Date: Dec 2011
Location: Johannesburg South Africa
Experience: Intermediate
20-Jul-2012, 07:48 AM #1
Solved: MySql - When to close the db?
Can anyone advise me as to when it is best to close an open DB? OR Is it safe to leave the DB open for the SESSION and close on logout? OR will session_destroy() close an open DB?

Last edited by JiminSA; 20-Jul-2012 at 07:50 AM.. Reason: typo
allnodcoms's Avatar
allnodcoms   (Danny) allnodcoms is offline allnodcoms has a Profile Picture
Computer Specs
Member with 610 posts.
 
Join Date: Jun 2007
Location: Hertfordshire - England
Experience: Advanced
20-Jul-2012, 11:48 AM #2
The DB will automatically close when the script exits mate, but it's a good idea to close ASAP if you've got multiple connections (i.e. multiple viewers on-line simultaneously).

For the most part you can leave it to close itself, but it's good form to close when you're done with all DB activity in a script.

Danny
JiminSA's Avatar
JiminSA   (Jim) JiminSA is offline JiminSA has a Profile Picture
Computer Specs
Member with 1,704 posts.
THREAD STARTER
 
Join Date: Dec 2011
Location: Johannesburg South Africa
Experience: Intermediate
20-Jul-2012, 12:55 PM #3
Cool and concise kiddo! Ta!
dukevyner's Avatar
dukevyner   (Luke) dukevyner is offline
Computer Specs
Member with 787 posts.
 
Join Date: Nov 2011
Location: Pakenham, VIC, Australia
Experience: Advanced
21-Jul-2012, 02:54 AM #4
and if you do feel you need to close it
Quote:
mysql_close($con);
$con being the variable used to connect... Do they say "ta" in England? I know they would have no idea what you meant in America.
JiminSA's Avatar
JiminSA   (Jim) JiminSA is offline JiminSA has a Profile Picture
Computer Specs
Member with 1,704 posts.
THREAD STARTER
 
Join Date: Dec 2011
Location: Johannesburg South Africa
Experience: Intermediate
21-Jul-2012, 03:07 AM #5
Yup, duke - 'ta' as you know is abbreviated thanks - and you'd be surprised how many Brit colloquialisms are world-wide...
dukevyner's Avatar
dukevyner   (Luke) dukevyner is offline
Computer Specs
Member with 787 posts.
 
Join Date: Nov 2011
Location: Pakenham, VIC, Australia
Experience: Advanced
21-Jul-2012, 03:23 AM #6
Quote:
Originally Posted by JiminSA View Post
Yup, duke - 'ta' as you know is abbreviated thanks - and you'd be surprised how many Brit colloquialisms are world-wide...
Yeah being born and lived in Australia I knew that ta is thanks but I spent 9 years in the states the don't say ta... Was just curious if they did in England
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑