Re: What is wrong with next code
| From: | John Holmes | Date: | Fri, 29 Oct 2004 03:08:39 +0000 |
| Subject: | Re: What is wrong with next code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200604@lists.php.net to get a copy of this message | ||
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