On Tue, 20 Jul 2004 22:47:43 -0700 (PDT), mukta telang <[EMAIL PROTECTED]> wrote: > Hi, > I want to use mysql persistent connection to connect > to mysql and use the connection identifier or handle > in subsequent pages/scripts. So in script1.php I have > session_start(); > session_register('conn'); > HTTP_SESSION_VARS['conn']=mysql_pconnect(...); > > and in script2.php I have, > > echo $conn; > > and I always get "1" as output and not Resource#.. as > expected.. >
As an earlier poster said, you can't store resources in sessions (or get, post or cookies) because it's "closed" when the script ends. However, when you use a persistent database connection, PHP tries to keep the connection open on the server side. The next time you call pconnect for the same DB, it will use the saved connection automatically. Please read the manual on the funcitons you're using before posting to the list... -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php