RE: mssql_* overhead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx]
Sent: Wednesday, January 10, 2007 5:37 PM
To: bedouglas@xxxxxxxxxxxxx
Cc: 'php General List'
Subject: Re:  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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux