flyersun
flyersun

Reputation: 917

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 giving it a name?

mysql_close($connectionname);

Thanks!

Upvotes: 0

Views: 106

Answers (1)

BoltClock
BoltClock

Reputation: 723628

Simply close it without passing anything:

mysql_close();

If you only open one MySQL connection, that will be the one that gets closed.

Upvotes: 2

Related Questions