Close connection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CerIs
Forum Newbie
Posts: 22
Joined: Sat May 29, 2004 9:20 am

Close connection

Post by CerIs »

I always thought php closed your database connection automaticly. However i think this is not the case when using mysql_pconnect ? How do you close it?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

If you need the connection to close then use mysql_connect().
CerIs
Forum Newbie
Posts: 22
Joined: Sat May 29, 2004 9:20 am

Post by CerIs »

Does that mean it closes automaticly?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Yes, if you use mysql_connect() it will close automatically. If you use mysql_pconnect() the conection will be open between requests and will not close when the script ends. Even mysql_close() will not close a mysql_pconnect() link.
Post Reply