-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathClient.php
100 lines (74 loc) · 2.7 KB
/
Client.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
class Client{
private $idClient;
private $emailClient;
private $nameClient;
private $senhaClient;
public function getIdClient(){
return $this->idClient;
}
public function getNameClient(){
return $this->nameClient;
}
public function getSenhaClient(){
return $this->senhaClient;
}
public function getEmailClient(){
return $this->emailClient;
}
public function setIdClient($id){
$this->idClient = $id;
}
public function setNameClient($name){
$this->nameClient = $name;
}
public function setSenhaClient($senha){
$this->senhaClient = $senha;
}
public function setEmailClient($email){
$this->emailClient = $email;
}
public function register($client){
$connection = Connection::getConnection();
$queryInsert = "INSERT INTO tbcliente (nomecliente, senhacliente, emailcliente)
VALUES ('".$client->getNameClient()."'
,'".$client->getSenhaClient()."'
,'".$client->getEmailClient()."')";
$connection->exec($queryInsert);
return 'Cadastro realizado com sucesso';
// return $queryInsert;
}
public function getClientData($id){
$connection = Connection::getConnection();
$queryInsert = "SELECT * from tbcliente
where idcliente = $id";
$stmt = $connection->prepare($queryInsert);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}
public function list(){
$connection = Connection::getConnection();
$querySelect = "SELECT * FROM tbcliente";
$result = $connection->query($querySelect);
$list = $result->fetchAll();
return $list;
}
// public function edit($cliente){
// $conexao = Conexao::pegarConexao();
// $queryUpdate = "update tbCliente
// set nomecliente = '".$cliente->getNomeCliente()."'
// , cpfcliente = '".$cliente->getCpfCliente()."'
// , rgcliente = '".$cliente->getRgCliente()."'
// , emailcliente = '".$cliente->getEmailCliente()."'
// where idcliente = ".$cliente->getIdCliente();
// $conexao->exec($queryUpdate);
// return 'Atualização realizada com sucesso';
// }
// public function delete($cliente){
// $conexao = Conexao::pegarConexao();
// $queryUpdate = "delete from tbCliente
// where idcliente = ".$cliente->getIdCliente();
// $conexao->exec($queryUpdate);
// return 'Exclusão realizada com sucesso';
// }
}