-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFuncoesDB.php
More file actions
62 lines (49 loc) · 1.77 KB
/
FuncoesDB.php
File metadata and controls
62 lines (49 loc) · 1.77 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
59
60
61
62
<?php
include_once './Conexao.php';;
class FuncoesDB {
private $con;
private $conectado;
public function __construct() {
$this->con = new Conexao();
}
public function inserir($login, $password, $email, $saldo){
$sql = "INSERT INTO usuarios(login, password, email, saldo) VALUES('$login', '$password', '$email', '$saldo')";
if(is_null($this->con)){
return $this->con->conectar()->query($sql);
}
return $this->con->conectar()->query($sql);
}
public function deletar($id){
$sql = "DELETE FROM usuarios WHERE ID = '$id'";
if(is_null($this->con)){
return $this->con->conectar()->query($sql);
}
return $this->con->conectar()->query($sql);
}
public function alterar($id, $email, $saldo){
$sql = "UPDATE usuarios SET email = '$email', saldo = '$saldo' WHERE ID = '$id'";
if(is_null($this->con)){
return $this->con->conectar()->query($sql);
}
return $this->con->conectar()->query($sql);
}
public function pesquisarAll(){
$sql = "SELECT * FROM usuarios";
if(is_null($this->con)){
return $this->con->conectar()->query($sql);
}
return $this->con->conectar()->query($sql);
}
public function verificar($login, $password){
$sql = "SELECT * FROM usuarios WHERE login = '$login' AND password='$password'";
if(is_null($this->con)){
return $this->con->conectar()->query($sql);
}
return $this->con->conectar()->query($sql);
}
public function close(){
if(is_null($this->con)){
$this->con->desconectar();
}
}
}