Page 1 of 1

help with error message

Posted: Tue Apr 24, 2007 8:32 pm
by royrogersrevenge
Hey Everyone,

I have a site that is working more or less ideally yet it continues to shoot this error message at me.
Warning: mysql_close(): 13 is not a valid MySQL-Link resource in /home/media233/public_html/stop.php on line 2
The contents of stop.php is simply:

Code: Select all

<?php
        mysql_close($socket);
?>
Any idea what the problem may be here?

Posted: Tue Apr 24, 2007 8:34 pm
by John Cartwright
I am guessing $socket is not a valid mysql link created by mysql_connect()

what does

Code: Select all

var_dump($socket)
yield?

Posted: Tue Apr 24, 2007 8:45 pm
by royrogersrevenge
It gives me:
resource(4) of type (mysql link)
Not certain what this means..

Posted: Wed Apr 25, 2007 10:13 am
by royrogersrevenge
It really doesn't appear to have any negative effect. Everything else works properly. Does anyone have an idea?

Posted: Wed Apr 25, 2007 10:22 am
by aaronhall
Is var_dump($socket) being called from stop.php? Are you sure that stop.php is being included into a context from which $socket is accessible?

Also, PHP will close all open MySQL connection at the end of the script, so it might not be necessary for you to close the connection with mysql_close.

Posted: Wed Apr 25, 2007 4:04 pm
by royrogersrevenge
Well I'm still not sure what the problem was, but I took your advice and just let php close mysql connections itself, and it works fine. Thanks for the help!