# prthomp@xxxxxxxx / 2007-01-10 10:49:35 -0600: > On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote: > >Philip Thompson wrote: > >>Does anyone know if the mssql_connect/_init/_bind/etc require a > >>lot of overhead? You can quite easily find out what effect those function have on the performance profile of your program with xdebug. > >>I have a page that requires multiple function calls and each of those > >>opens a new connection to the database, performs the necessary > >>actions in stored procedure(s), and then closes the connection. > >>However, I found this to be slower than I was wanting. *What* have you found slower? Which of the multiple actions you mention are you talking about? > >>So I thought, just create one connection and assign it to the > >>SESSION (a global), and in each function that requires a > >>connection, call that SESSION variable. At the end of the page, > >>close the connection and nullify the variable. > > > >I wouldn't stick it in the SESSION superglobal (my tactic is usually > >to create a little wrapper class to the relevant DB functions and > >store the connection as a property of the class/object. > > > >basically opening & closing the connection once per request is the > >way to go - if your going to using a global, better [than $_SESSION] > >to stick it in $GLOBALS imho. > > Would there be any speed decrease with multiple users (hundreds) > sharing this $GLOBALS variable (if that makes sense)? Looks like you're confused about semantics associated with $GLOBALS and $_SESSION. In the context of web servers, $GLOBALS is limited to the current request, $_SESSION persists across requests for a single *session*, just as Jochem wrote. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php