Received: from newman.hartehanks.com (newman.hartehanks.com [204.89.158.3]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fADKk4m50238 for ; Tue, 13 Nov 2001 15:46:04 -0500 (EST) (envelope-from Timothy_Maguire@hartehanks.com) Received: from linmail.hartehanks.com (linmail.hartehanks.com [172.21.116.31]) by newman.hartehanks.com (8.11.2/8.11.2) with ESMTP id fADKlPg25196 for ; Tue, 13 Nov 2001 15:47:25 -0500 Subject: db connections in session variables To: pgsql-php@postgresql.org X-Mailer: Lotus Notes Release 5.0.6a January 17, 2001 Message-ID: From: Timothy_Maguire@hartehanks.com Date: Tue, 13 Nov 2001 15:36:59 -0500 X-MIMETrack: Serialize by Router on linmail/Harte-Hanks(Release 5.0.8 |June 18, 2001) at 11/13/2001 03:36:59 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Archive-Number: 200111/1 X-Sequence-Number: 648 I was wondering if it were possible to store a database connection in a session variable. I have tried these 2 methods: $conn = pg_pconnect("server", "5432", "db"); session_start(); session_register('conn'); $conn = pg_pconnect("server", "5432", "db"); session_id($conn); session_start(); both of them register a session with the value of "Resource id #1" but don't act as a db connection. I am just trying to clean up some code so I don't have to do a new database connection on every page that I create. Then if you are able to do this, where would you close the connection? I guess in ASP, it is possible to store db connections in a session variable. I have never done it there either but someone told me that you can. Tim. Timothy P. Maguire Web Developer II Harte-Hanks 978 436 3325