Can I close an unnamed mysql connection?
I've been doing some upgrades to a friends website. But now it looks like the original programmer didn't close any mysql connections.. or at least I can't find any place where they closed them. The site fell over this morning and I thought it was due to the web server but turned out the database server was over loaded. I'm now looking at the code but being a bit rusty with php I'm not sure how to close the connections at the bottom of the page.
mysql_connect(localhost,$dbuser,$dbpass);
@mysql_select_db($dbase);
This code is in a file that I don't want to touch unless I really have to.. Is there any way for me to close the connection without givin开发者_如何学Gog it a name?
mysql_close($connectionname);
Thanks!
Simply close it without passing anything:
mysql_close();
If you only open one MySQL connection, that will be the one that gets closed.
精彩评论