I get an error message saying:
mysql_close(): no MySQL-Link resource supplied
But it doesn’t happen every time the script executes. I can’t figure out when it does happen. Can somebody tell me what’s going on and how to fix it? Thanks.
I get an error message saying:
mysql_close(): no MySQL-Link resource supplied
But it doesn’t happen every time the script executes. I can’t figure out when it does happen. Can somebody tell me what’s going on and how to fix it? Thanks.
just don’t include mysql_close();.
I never use it, i don’t know anyone who does.
see the documentation for info and an example of how to use a function.
youre getting that error because you didnt pass a link to the function. as the manual sais, if you dont pass a link, it uses the last opened connection. if you didnt open a connection, it tries to create one so it can close it(pointless).
solution? dont use the function unless you have a connection to be closed, or just dont even close it, php will do it for you.
read the manual.
Only time to explicitly close the connection is if you have a script that will continue to execute for a long time after the DB connection is needed (e.g image processing, mailing, serving file download).
Otherwise the connection is closed anyway.