From:             [EMAIL PROTECTED]
Operating system: Linux Mandrake 7.0 / any really.
PHP version:      4.0.4pl1
PHP Bug Type:     *Function Specific
Bug description:  Function with mysql_close($conn) closes top level scripts $conn

Please Also Refer to Bug Report 9049 :
I believe I am having the same problem. I think I have worked out why tho.

I have two files.
One has a function in it.
Both files require a connection to mysql database.
Both connections use the $conn as their pointer.
If you mysql_close($conn) within the function in the second file
then it closes the $conn in the script calling the function.
So you have to remove the mysql_close from your function
and even the $conn=mysql_connect from it and just pass the
$conn as a variable to the function :
function foo($conn){
$result=mysql_db_query("test","select ...",$conn);
called from say test.html

was like this :

function foo()
## query work etc..

main script :
#anything in here
#call function

the last line brings up the error about the mysql link resource being wrong as the 
$conn was closed in the function but somehow closed it globally too. Which is a bit of 
a pain as this was ok before upgrading to Pl4

I didnt see anything in the change file about this :L So I can only assume
this is a bug.

If you need more info from me please let me know.. Thanks for all the good work guys 

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to