FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » I need Help
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: I need Help [message #169721 is a reply to message #169717] Thu, 23 September 2010 20:37 Go to previous messageGo to previous message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma:
Senior Member
Michael Fesser wrote:

> .oO(Beauregard T. Shagnasty)
>> Jerry Stuckle wrote:
>>> Never a good idea to allow PHP to close the connection. Close it
>>> yourself when you're done!
>>
>> Rule 13:
>> open the db connection
>> do your query, your select, update, insert, whatever
>> close the db connection
>> proceed with other coding
>
> I open the connection when my scripts initialize themselves and close
> it when everything's done. I don't know beforehand which parts of my
> code might need DB access for answering the current request and I
> don't want to open/close the connection over and over again. So it
> stays open until the end. In fact in a normal PHP script it doesn't
> make much of a difference if you close the connection one or two
> milliseconds earlier.

Sure, if you have multiple db accesses, don't close it until the last
one is executed. That would be a given, of course. "Rule 13" was just a
basic guideline, stating the programmer should close the connection and
not allowing some timeout to handle it. ;-)

--
-bts
-Four wheels carry the body; two wheels move the soul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Book problems and solution for windows 7
Next Topic: Syntax for array?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 14:46:57 GMT 2024

Total time taken to generate the page: 0.04212 seconds