Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    61

    Unanswered: when to colse mysql connection?

    I have a php website connected to mysql.

    Everypage that runs a query first has the connection line:

    $db = mysql_connect("localhost", "root","");
    mysql_select_db("logbook",$db);
    (PS - don't worry, it's running on webserver localhost port 80 closed to public)

    Anyway, when do i need to close the mysql connection?
    The user would maneuver around these pages....
    Should i have a mysql_closec -> when he/she loggs off the website?
    Why do i need to close the connection? What are the benifits?

    thanks
    Noam

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    17
    If you don't use persistent connection, the connection is automatically closed at script end.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •