Re: What is wrong with next code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux