1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: MySql - When to close the db?

Discussion in 'Web Design & Development' started by JiminSA, Jul 20, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    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?
     
  2. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    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
     
  3. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    Cool and concise kiddo! Ta!
     
  4. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    and if you do feel you need to close it
    $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.
     
  5. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    Yup, duke - 'ta' as you know is abbreviated thanks - and you'd be surprised how many Brit colloquialisms are world-wide...
     
  6. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    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
     
  7. Sponsor

As Seen On
As Seen On...

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.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1061844