hercioneto

Exercicio7 dadosClientes.php

Apr 29th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2. include "Clientes.php";
  3. $cliente = new Clientes();
  4. $cliente->setNome("João");
  5. $cliente->setDataNascimento("30/04/1983");
  6. echo "Dados do cliente: <br>";
  7. echo "Nome: ". $cliente->getNome() . "<br>";
  8. echo "Data de Nascimento: ". $cliente->getDataNascimento() . "<br>";
  9. $cliente->calcularIdade();
  10. echo "Idade: ". $cliente->getIdade() . "<br>";
  11.  
  12. //incluir
  13. $dados = $cliente->inserir();
  14.  
  15. if ($dados === true) { echo "Aee inseriu"; } else {
  16.  echo "Errrouuu " . $dados; }
  17. echo "<br>";
  18.  
  19. //listar
  20. $dados = $cliente->listar();
  21.  
  22. while ($row = $dados->fetch_assoc()) {
  23.         printf ("%s (%s)\n", $row["idCliente"], $row["nome"]);
  24.         $idade = $row["idade"];
  25.         $dataNasc = $row["dataNascimento"];
  26.         echo " - $dataNasc - $idade";
  27.         echo "<br>";
  28.     }
  29.  
  30.  
  31. ?>
Add Comment
Please, Sign In to add comment