-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbConnection.php
48 lines (35 loc) · 957 Bytes
/
dbConnection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// class DbConnection{
// private $server = "localhost";
// private $username = "root";
// private $password = "";
// private $database = "TaskManagementSystem";
// protected $connection = "";
// function databaseConnection(){
// $server = $this->server;
// $username = $this->username;
// $password = $this->password;
// $database = $this->database;
// try{
// $this->connection = new mysqli($server, $username, $password, $database);
// return $this->connection;
// }
// catch(mysqli_sql_exception $exception){
// return $exception;
// }
// }
// }
$servername = 'localhost';
$username = 'root';
$password = '';
$database = 'formDB';
// Create connection
$connection = new mysqli($servername, $username, $password, $database);
if(mysqli_connect_error()){
die("Connection failed: " . $connection->connect_error);
}
else
{
// echo "Connection is established";
}
?>