Re: Resource id #X

From: Date: Thu, 18 Aug 2005 08:44:13 +0000
Subject: Re: Resource id #X
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220839@lists.php.net to get a copy of this message
On Thu, August 18, 2005 1:00 am, Chris Boget wrote: > * User A accesses page X, which makes a connection to the database. > Echoing > out the result of the mssql_pconnect() function shows it's using > 'Resource id #10'. > * User B accesses the same page, X, making another connection to the > database. > Echosing out the result of the pconnection function shows it's using > 'Resource id > #10' > > Now, even though they are showing the same resource id, it's not > actually the > same connection, correct? Correct. If you echo out EVERY connection/result/resource, you will see that PHP pretty much just starts counting at 1 at the beginning of a script and increments the resource counter on each resource. Change the script to, say, connect to some other database at the top, and everything will be "off" by 1 from the previous user. > BEGIN TRAN (user a) > BEGIN TRAN (user b) > Query (user b) > Query (user a) > ROLLBACK (user b) > COMMIT (user a) > > with User B rolling back User A's transaction and User A committing > User > B's > transaction (or no transaction at all). Hmmmmm. Take out the _pconnect. Or switch to MySQL or PostgreSQL maybe for a test, just to see if their transactions exhibit the same behaviour. SQL Server is the least-broken Microsoft product... You could also try using the Sybase drivers to connect to MS SQL. Last I heard, they were faster anyway. Though it's been years since anybody has had enough money to get me to use an MS product. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#220839) next »