We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b654510 + 90f26fb commit 240a4fdCopy full SHA for 240a4fd
2 files changed
MysqliDb.php
@@ -289,6 +289,20 @@ public function connect()
289
}
290
291
292
+ /**
293
+ * A method to disconnect from the database
294
+ *
295
+ * @throws Exception
296
+ * @return void
297
+ */
298
+ public function disconnect()
299
+ {
300
+ if (!$this->_mysqli)
301
+ return;
302
+ $this->_mysqli->close();
303
+ $this->_mysqli = null;
304
+ }
305
+
306
/**
307
* A method to get mysqli object or create it in case needed
308
*
readme.md
@@ -699,6 +699,11 @@ if($db->has("users")) {
699
700
```
701
### Helper methods
702
+Disconnect from the database:
703
+```php
704
+ $db->disconnect();
705
+```
706
707
Reconnect in case mysql connection died:
708
```php
709
if (!$db->ping())
0 commit comments