RE: [PHP] mssql_* overhead
| From: | bruce | Date: | Thu, 11 Jan 2007 02:22:18 +0000 |
| Subject: | RE: [PHP] mssql_* overhead | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246888@lists.php.net to get a copy of this message | ||
hey chris..
you're confirming what i had seen/experienced.. just wanted to better
understand what phillip was saying.
thanks
-bruce
-----Original Message-----
From: Chris [mailto:dmagick@gmail.com]
Sent: Wednesday, January 10, 2007 5:37 PM
To: bedouglas@earthlink.net
Cc: 'php General List'
Subject: Re: [PHP] mssql_* overhead
bruce wrote:
> hi phillip...
>
> just to clarify regarding having the mysql resource ID in a session var.
are
> you saying that you're able to more or less, do a mysql_connect and store
> the resourceID in a session var, which can then be used on any given page
> within your site, without having to recall the mysql_connect to establish
a
> new connection?
>
> at one time, i had played with how this might be accomplished, and could
> never get it to work, without having to get into the idea/area of
connection
> pools...
No, that won't work (one minor irrelevant detail - he's talking about
mssql not mysql - but either way it doesn't matter - I'm just being
pedantic :P).
Resource connections cannot be stored in the session and then re-used in
another page request.
You could put the resource in the session variable and then re-use it
from the session within the same request, but it's not going to work if
you go to another page.
To confirm that, try a simple page:
<?php
session_start();
echo '<pre>';
var_dump($_SESSION);
$connection = mysql_connect(....);
$_SESSION['DbConnection'] = $connection;
$_SESSION['AnotherVariable'] = 1;
var_dump($_SESSION);
?>
View the page, you'll see an empty array at the top and two variables at
the bottom.
Refresh the page and you'll see two variables in $_SESSION - however the
DbConnection will always be 0 (false).
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php