|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Closing/Opening Connection OBjects
I have the following lines of codes
GetLanguage(); GetPrivilege(); GetLogonuser(); include("includes/db_connect.php"); . . . My remaining php codes and html content below . . . Inside of my first 3 functions, I open/created a connection object to the database, do the designated job, closed connection and get out. Hence, looks like i am creating/closing the conn object 6 times. THen, I open another connection in my include statement and use this as my connection object for the rest of the php codes after it. Is this efficient. Will there be noticeable slow down in performance. Or should I just put the includes statement right at the top, and have each of the function global the conn object in? btw, using Postgres.
__________________
Beginner |
|
#2
|
|||
|
|||
|
I don't have any concrete examples for proof of concept, however, I've definately found that when using a connection more than twice in the same script it is more effecient to keep a persistent connection open then just allow the ending of the script to automatically close the connection which is the default.
-- Wil Moore III www.wilmoore.com
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Closing/Opening Connection OBjects |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|