I has noted specially: It works OK in PHP 4.3.6 or when line "$db2 = 0;" had been commented in all described versions of PHP. So next example works perfect: ------------------------------------------------- error_reporting(E_ALL); $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); $result = mysql_query('SELECT 1+1', $db1); if ($result) { $row = mysql_fetch_row($result); echo "Result: {$row[0]}\n"; } ------------------------------------------------- root@gate:~/src/PHP# php -q mysql_connect3.php Result: 2 On Thu, 28 Oct 2004 23:08:39 -0400 John Holmes <holmes072000@xxxxxxxxxxx> wrote: > Vladimir Shiray wrote: > > ------------------------------------------------- > > Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... > > $result = mysql_query('SELECT 1+1', $db1); > > ------------------------------------------------- > [snip] > > $db1 = mysql_connect ('localhost', 'test', '1'); > > $db2 = mysql_connect ('localhost', 'test', '1'); > > mysql_close($db2); > > If you connect with the same parameters, PHP will just reuse the > previous connection. So you only have one connection and closing either > one will result in the connection being lost, hence the "invalid link > resource" message. > > -- > > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals _ www.phparch.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php