#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    12
    Rep Power
    0
    What is the pro of opening a mysql_pconnect instead of a mysql_connect (speed ?)
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Yes. pconnect uses an existing connection between the php module and mysql (if there is one). However, connections do not remain persistent unless php is a module.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    12
    Rep Power
    0
    But when should I close the database connection, if I don't close it at the end of the php script ?
    And if the database is already open what is the effect of a second mysql_pconnect ?

    Thank you
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You don't need to worry about closing the connection. If you use mysql_connect() it will automatically close when the script exits. If you use mysql_pconnect() any mysql_close() you use will be ignored.

    If a connection already exits, the link id of the current connection will be returned.

IMN logo majestic logo threadwatch logo seochat tools logo