PEAR::DB and PHP5

From: Date: Mon, 04 Oct 2004 16:36:04 +0000
Subject: PEAR::DB and PHP5
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14746@lists.php.net to get a copy of this message
Hi, today i tried to port my running application to PHP5 and failed. What i basically do is this: function get_clients() { $db = db_connect(); $res = $db->query($sql); while ($client = $res->fetchRow()) { $clients[] = get_client( $client['client_id'] ); } $db->disconnect(); } So my function opens a connection does something and disconnects at the end. That works well, but notice the get_client() within the loop. It works the same. opens does something and closes the connection. Now when the get_clients() tries to close the connection i get the following error: "mysql_close(): 24 is not a valid MySQL-Link resource" But that would mean that both functions share the same connection? How is that possible? My connect looks like this: function db_connect() { /* open connection */ $db =& DB::connect($GLOBALS['DSN']); /* set fetchmode */ $db->setFetchMode(DB_FETCHMODE_ASSOC); return $db; } IMHO that should have worked worked!?! I'm sure it has something todo with call by reference or not and sharing the same object. Who can enlighten me? The same thing works fine in PHP4. I did search PEAR and PHP manual without success. Thanks for your time Michael ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/

« previous php.pear.general (#14746) next »