2 Apr 2006 01:07
Re: MySQL close connection, what's the purpose?
Jasper Bryant-Greene <jasper <at> album.co.nz>
2006-04-01 23:07:43 GMT
2006-04-01 23:07:43 GMT
tedd wrote: >> > > > I always close the connection right after my >>> > > query -- force of habit. It's like leaving the >>> > > toilet seat up, it's only going to get you into >>> > > trouble. >>> > >>> > So you close it after every query and then re-open it later for the >>> > next query? I don't see that as a good idea. >> > > >> > No, you leave it open until you're done with the database. >> >> Reading Ted's post didn't give this impression. I wanted to make sure >> he wasn't doing it that way. > > Chris et al: > > Actually I am. When I need something from the dB, I open it, get the > information and close it. It's like opening a drawer, getting what you > need, and then closing the drawer. Where's the problem? Uh, what if you want to do more than one query in a single request? You aren't seriously suggesting you would connect and disconnect from the same database multiple times within the same request? In my experience, connecting to the database takes up more than half of the execution time of the average database-driven PHP script (I said *average*, there are exceptions). You don't want to be doing it multiple times if you don't have to. -- Jasper Bryant-Greene General Manager Album Limited http://www.album.co.nz/ 0800 4 ALBUM jasper <at> album.co.nz 021 708 334 -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RSS Feed