Guest User

Untitled

a guest
May 2nd, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. include "class-db.php";
  3. include "data.class.php";
  4.  
  5. //Lista os aniversariantes, de hoje a ate daqui a 30 dias.
  6. // Configure as informacoes pertinentes ao banco:
  7. $database = "pina";
  8. $servidor = "localhost";
  9. $user = "root";
  10. $pass = "";
  11. $tabela = "clientes";
  12. $nome = "nome";
  13. $telefone = "telefone";
  14. $datanascimento = "data";
  15. //EDITAR ATE AQUI!
  16.  
  17.  
  18. define('DB_CONNECTIONSTRING',"mysqldb://$database;$servidor;$user;$pass");
  19. $db = db::getInstance(DB_CONNECTIONSTRING);
  20. $db->verbose = 3;
  21. //mysql_set_charset("uft8");
  22. $data = Data::b(Data::agora());
  23. $clientes = $db->select_rows($tabela, "$nome, $telefone, $datanascimento", "$datanascimento", "WHERE '$datanascimento' BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL 30 DAY");
  24. ?>
  25. Nome: Telefone: Data de Nascimento: <br />
  26. <?php
  27. if (!$clientes) {
  28. echo "Nao ha clientes cadastrados.";
  29. }else {
  30. foreach ($clientes as $cliente) {
  31. if($cliente[$datanascimento] == $data) {
  32. echo "<strong> $cliente[$nome] $cliente[$telefone] ".Data::m($cliente[$datanascimento])."</strong>";
  33. }
  34. else {
  35. echo "$cliente[$nome] $cliente[$telefone] ".Data::m($cliente[$datanascimento]);
  36. }
  37. echo "<br />";
  38. }
  39. }
  40. ?>
Add Comment
Please, Sign In to add comment