help with error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
royrogersrevenge
Forum Newbie
Posts: 14
Joined: Fri Apr 06, 2007 9:57 pm

help with error message

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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?
royrogersrevenge
Forum Newbie
Posts: 14
Joined: Fri Apr 06, 2007 9:57 pm

Post by royrogersrevenge »

It gives me:
resource(4) of type (mysql link)
Not certain what this means..
royrogersrevenge
Forum Newbie
Posts: 14
Joined: Fri Apr 06, 2007 9:57 pm

Post by royrogersrevenge »

It really doesn't appear to have any negative effect. Everything else works properly. Does anyone have an idea?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
royrogersrevenge
Forum Newbie
Posts: 14
Joined: Fri Apr 06, 2007 9:57 pm

Post 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!
Post Reply