Reply to Re: [PHP] Resource id #X

Your name:

Reply:


Posted by "Richard Lynch" on 08/18/05 11:44

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация