|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-09-03 14:57 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 27 05:00:01 2025 UTC |
Description: ------------ 1. Constant LINK is set. 2. In a file login.php before function "auth" I check that constant LINK exists: resource (4) of type (mysql link) 3. Function "auth" from a file login.php is started. 4. In the function beginning I check that constant LINK exists: resource (4) of type (mysql link) 5. I close connection mysql_close(LINK); 6. After mysql_close(LINK) I check that constant LINK exists: a constant is damaged: resource (4) of type (Unknown). Reproduce code: --------------- configdb.php define ('DBHOST', "localhost"); define ('DBUSER', "root"); define ('DBPASSWORD', "xxxxx"); define ('DBNAME', "base1"); define ('LINK', mysql_connect(DBHOST, DBUSER,DBPASSWORD)); ---------------- login.php var_dump(LINK); // resource(4) of type (mysql link) if (isset($_POST["confirmForm"]) && !empty($_POST["confirmForm"])){ auth($_POST["nameForm"], $_POST["passwordForm"]);} var_dump(LINK);// resource(4) of type (Unknown) ---------------- lib.php function auth($name, $password){ var_dump(LINK); // resource(4) of type (mysql link) $query = "select count(*) from Names where name='$name' and password=MD5('$password')"; $result=mysql_query($query, LINK); $row=mysql_fetch_array($result); resource(4) of type (mysql link) mysql_close(LINK); var_dump(LINK);// resource(4) of type (Unknown)} Expected result: ---------------- I want that constant LINK did not change after mysql_close(LINK). I want that after run mysql_close(LINK): resource(4) of type (mysql link) Actual result: -------------- resource(4) of type (Unknown)