w3resource

PHP mysqli: close() function

mysqli_close() function / mysqli::close

The mysqli_close() function / mysqli::close closes a previously opened database connection.

Syntax:

Object oriented style

bool mysqli::close ( void )

Procedural style

bool mysqli_close ( mysqli $link )

Usage: Procedural style

mysqli_close(connection);

Parameter:

Name Required/Optional Description
connectionn Required Specifies the MySQL connection to close

Return value:

Returns TRUE on success or FALSE on failure.

Version: PHP 5, PHP 7

Example

<?php
$con=mysqli_connect("localhost","user1","datasoft123","hr");

// ....some PHP code...

mysqli_close($con);
?>

See also

PHP Function Reference

Previous: client_version
Next: commit



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/mysqli_close.php