-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.php
More file actions
executable file
·41 lines (35 loc) · 831 Bytes
/
database.php
File metadata and controls
executable file
·41 lines (35 loc) · 831 Bytes
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
<?php
/**
* Created by PhpStorm.
* User: pazay
* Date: 27.07.2017
* Time: 22:39
*/
class Database
{
public $mysqli;
private $host;
private $username;
private $password;
private $database;
public function __construct()
{
$this->connect();
}
private function connect()
{
$this->host = 'localhost';
$this->username = 'pashutaz';
$this->password = 'qwerty123';
$this->database = 'mydb';
$this->mysqli = new mysqli($this->host, $this->username, $this->password, $this->database);
if (mysqli_connect_error()) {
die(mysqli_errno($this->mysqli) . mysqli_connect_error());
}
return $this->mysqli;
}
public function do_query($query)
{
return mysqli_query($this->mysqli, $query);
}
}