-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_future.php
More file actions
58 lines (49 loc) · 1.43 KB
/
Copy pathdb_future.php
File metadata and controls
58 lines (49 loc) · 1.43 KB
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
48
49
50
51
52
53
54
55
56
57
58
<?php
class dbConfig
{
private $dbDriver = "mysql";
private $host = "10.41.26.10";
private $username = "taufik";
private $password = "W4zI57";
private $database = "surveilance";
protected $connection;
public function __construct(){
try{
$this->connection = new PDO($this->dbDriver.':host='.$this->host.';dbname='.$this->database,$this->username,$this->password);
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e){
die("Connection Error vro: " . $e->getMessage());
}
}
}
class methodDB extends dbConfig{
public function getUsers($id){
$query = "SELECT * FROM `registrasi` WHERE step = 'selesai' AND status = 1 AND arr_step!='' AND user_id = ".$id;
try{
$result = $this->connection->query($query);
return $result->fetchAll();
}
catch (PDOException $e){
die("Create Error: " . $e->getMessage());
return false;
}
}
// public function insertUsers($data){
// $query = "INSERT INTO users VALUES(:id,:lastChat)"; //query
// try{
// $result = $this->connection->prepare($query);
// $result->execute([
// ':id' => 1,
// ':lastChat' => $data
// ]);
// return true;
// }
// catch (PDOException $e){
// die("Create Error: " . $e->getMessage());
// return false;
// }
// }
}
$db = new methodDB();
var_dump($db->getUsers(100001561));