ID: 18292 Comment by: php at netsector dot net Reported By: Beater at orgalan dot de Status: Closed Bug Type: MySQL related Operating System: Windows 2000 PHP Version: 4.2.1 New Comment:
This bug appear again in PHP4.3.3 on W2k! Previous Comments: ------------------------------------------------------------------------ [2002-07-12 01:59:02] [EMAIL PROTECTED] This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. See the $new_link parameter at php.net/mysql_connect ------------------------------------------------------------------------ [2002-07-12 01:53:09] Beater at orgalan dot de <?php function test() { $link2 = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link2); echo mysql_error(); mysql_select_db('ratbytes', $link2); echo mysql_error(); $result = mysql_query('SELECT * FROM rb_user', $link2); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link2); echo mysql_error(); } $link = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link); echo mysql_error(); mysql_select_db('ratbytes', $link); echo mysql_error(); test(); $result = mysql_query('SELECT * FROM rb_user', $link); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link); echo mysql_error(); ?> produced following output: resource(1) of type (mysql link) resource(1) of type (mysql link) Warning: mysql_query(): 1 is not a valid MySQL-Link resource in ....test.php on line 25 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ....test.php on line 27 Warning: mysql_close(): 1 is not a valid MySQL-Link resource in ....test.php on line 29 ... works fine if no link_identifier is specified (mysql_close) <?php $link = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link); echo mysql_error(); mysql_select_db('ratbytes', $link); echo mysql_error(); // start inline $link2 = mysql_connect('localhost', 'phpde', 'phpde'); var_dump($link2); echo mysql_error(); mysql_select_db('ratbytes', $link2); echo mysql_error(); $result = mysql_query('SELECT * FROM rb_user', $link2); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link2); echo mysql_error(); // end inline $result = mysql_query('SELECT * FROM rb_user', $link); echo mysql_error(); mysql_fetch_array($result); echo mysql_error(); mysql_close($link); echo mysql_error(); ?> produced following output: resource(1) of type (mysql link) resource(1) of type (mysql link) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18292&edit=1