Home Keeping MYSQL connection open
Reply: 1

Keeping MYSQL connection open

Brady Tech
1#
Brady Tech Published in 2018-02-14 18:48:57Z

Is it possible to keep MySQL connection open from the beginning of a php file and close it at the end of that particular script? If yes please help me because I'm having problem with this: Prevent clash in MYSQL database

Thank you all.

EdKorket
2#
EdKorket Reply to 2018-02-14 19:36:42Z

This is how I open and close connection with my database:

$host = "localhost";
$root = "myusername";
$pass = "mypassword";
$DBname = "mydatabase";
$link = mysqli_connect($host, $root, $pass, $DBname);

function close_connection($link) {
  $link ->close();
}

I call the function close_connection() whenever I want to stop the connection with my database. Hope this helps!

-Ed

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.632589 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO