-
Notifications
You must be signed in to change notification settings - Fork 2
/
funcoes.php
56 lines (38 loc) · 1.24 KB
/
funcoes.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
<?php
require_once 'usuario.php';
require_once 'conexaoaula.php';
require_once 'index.php';
class bancoUsuario{
public function cadastrarUsuario(){
$conexaobd=new conexaobd();
$usuarios=new usuario();
$conexaobd->conectar();
$usuarios->setNome($_POST["nome"]);
$usuarios->setSenha($_POST["senha"]);
$usuarios->setTel($_POST["tel"]);
$nome=$usuarios->getNome();
$senha=$usuarios->getSenha();
$tel=$usuarios->getTel();
$consulta="INSERT INTO clientes (cod,nome,senha,tel)
VALUES(NULL,'$nome','$senha' ,'$tel')";
$conexaobd->query($consulta);
//echo $usuarios->getNome();
}
public function mostrarUsuarios(){
$conexaobd=new conexaobd();
$usuarios=new usuario();
$conexaobd->conectar();
$consulta="select * from clientes";
$dados=$conexaobd->query($consulta);
$numerol=$dados->num_rows;
$linha=mysqli_fetch_assoc($dados);
//echo $numerol;
echo "<table id=\"tabela1\"><tr><td id=\"coluna1\">Nome</td><td id=\"coluna1\">Senha</td><td id=\"coluna1\">Tel do Usuário</td></tr>";
if($numerol > 0) {
do {
echo "<tr><td id=\"coluna1\">" . $linha['nome'] . "</td><td id=\"coluna1\">" . $linha['senha'] . "</td><td id=\"coluna1\">" . $linha['tel'] . "</td></tr>";
}while($linha = mysqli_fetch_assoc($dados));
}
}
}
?>