mysql - Automatic db connection close in php? -


i have following in config.php file 1 of web app.

//db settings     $host = 'localhost'; //database location     $user = 'example'; //database username     $pass = 'example12'; //database password     $db_name = 'example'; //database name  //create db connection     $link = mysql_connect($host, $user, $pass);     mysql_select_db($db_name);  //sets encoding utf8     mysql_query("set names utf8"); 

i including config.php in pages of application @ top (1st line of code).

i want know php/mysql maintain connection open , close automatically or need explicitly call them. connection opening itself, doing db based tasks properly. not closing connection anywhere, high traffic website.

please correct me if wrong anywhere.

thanks!

the connection close automatically upon termination of script.

the notes on mysql_connect() state that:

the link server closed execution of script ends, unless it's closed earlier explicitly calling mysql_close().


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -