You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To be able to use the class and connect to the database, you have to instantiate it.
25
21
26
22
To do that, follow that format:
@@ -60,6 +56,65 @@ Simple example for instantiating the class:
60
56
$db = new DB('db-class-example', 'root', '');
61
57
```
62
58
59
+
### Check Connection to Database
60
+
The method `connected()` gives you the ability to check if the connection to the database was established successfully.
61
+
62
+
The method requires no arguments at all, so you can just call it and then it will give you a return value of `true` or `false` based on the fact if the connection was established or not.
63
+
64
+
Example:
65
+
```php
66
+
if ($db->connected()) {
67
+
echo 'Successfully connected!';
68
+
} else {
69
+
echo 'Connection failed';
70
+
}
71
+
```
72
+
73
+
### Select/Get Data from Database
74
+
In order to get data from the database you can use the method `select()` in the following format:
0 commit comments