View Discussion
Improve Article
Save Article
View Discussion
Improve Article
Save Article
MySQLi Procedural procedure:
To close the connection in mysql database we use php function mysqli_close[] which disconnect from
database. It require a parameter which is a connection returned by the mysql_connect function.
Syntax:
mysqli_close[conn];
If the parameter is not specified in mysqli_close[] function, then the last opened database is closed. This function returns true if it closes the connection successfully otherwise it returns false.
Below program illustrate the mysqli_close[] function
MySQLi Object-oriented procedure::
To close the connection in mysql database we use php function conn->close[] which disconnect from database.
Syntax:
conn->close[];
Program: To illustrate the closing of connection in object-oriented procedure.
Using PDO procedure:
To close the connection in MySQL database in PDO procedure we set the connection name to null which disconnect from the database.
Syntax:
conn=null;
Program: to illustrate the closing of connection in PDO procedure.
References: //php.net/manual/en/mysqli.close.php