-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeste.php
More file actions
88 lines (88 loc) · 2.74 KB
/
Teste.php
File metadata and controls
88 lines (88 loc) · 2.74 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
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
<?php
use core\CRUD;
use core\model\Usuario;
class Teste extends CRUD {
public function inserir() {
$dados = [
"nome" => "Marco Aurélio",
"cpf" => "012.345.678-90",
"senha" => "1234",
"email" => "teste@teste.com",
"data_nascimento" => "2000-01-01",
"telefone" => "(62) 9 9999-9999",
"endereco" => "Rua 01",
"bairro" => "Centro",
"estado" => "GO",
"cidade" => "Ceres",
"cep" => "76.300-000",
"nacionalidade" => "Brasileiro",
"ocupacao" => "Programador",
"admin" => 1
];
$retorno = $this->create("usuario", $dados);
echo "<pre>";
print_r($this->pegarUltimoSQL());
print_r("\n" . $retorno);
echo "</pre>";
}
public function atualizar() {
$dados = [
"usuario_id" => 3,
"nome" => "Marco Aurélio",
"cpf" => "036.566.561-42",
"senha" => "123456",
"email" => "teste@teste.com",
"data_nascimento" => "1992-09-12",
"telefone" => "(62) 9 9999-9999",
"endereco" => "Rua 01",
"bairro" => "Centro",
"estado" => "GO",
"cidade" => "Ceres",
"cep" => "76.300-000",
"nacionalidade" => "Brasileiro",
"ocupacao" => "Programador",
"admin" => 1
];
$where_condicao = "usuario_id = ?";
$where_valor[] = 3;
$retorno = $this->update("usuario", $dados, $where_condicao, $where_valor);
echo "<pre>";
print_r($this->pegarUltimoSQL());
print_r("\n" . $retorno);
echo "</pre>";
}
public function deletar() {
$where_condicao = "usuario_id = ?";
$where_valor[] = 5;
$retorno = $this->delete("usuario", $where_condicao, $where_valor);
echo "<pre>";
print_r($this->pegarUltimoSQL());
print_r("\n" . $retorno);
echo "</pre>";
}
public function selecionar() {
$campos = "*";
// $campos = "nome, email";
// $where_condicao = "admin = ?";
$where_condicao = "";
// $where_valor = [0];
$where_valor = [];
//
// $ordem = "senha DESC";
$ordem = null;
// $limite = 3;
$limite = null;
// $group_by = "nome";
$group_by = null;
$retorno = $this->read("usuario", $campos, $where_condicao, $where_valor, $group_by, $ordem, $limite);
echo "<pre>";
print_r($this->pegarUltimoSQL() . "\n");
print_r($retorno);
echo "</pre>";
}
public function listar() {
$usuario = new Usuario();
$retorno = $usuario->listar();
return $retorno;
}
}