Skip to content

Instantly share code, notes, and snippets.

@lunks
Created March 13, 2010 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunks/331582 to your computer and use it in GitHub Desktop.
Save lunks/331582 to your computer and use it in GitHub Desktop.
<?php
include "class-db.php";
include "data.class.php";
//Lista os aniversariantes, de hoje a ate daqui a 30 dias.
// Configure as informacoes pertinentes ao banco:
$database = "pina";
$servidor = "localhost";
$user = "root";
$pass = "";
$tabela = "clientes";
$nome = "nome";
$telefone = "telefone";
$datanascimento = "data";
//EDITAR ATE AQUI!
define('DB_CONNECTIONSTRING',"mysqldb://$database;$servidor;$user;$pass");
$db = db::getInstance(DB_CONNECTIONSTRING);
$db->verbose = 3;
//mysql_set_charset("uft8");
$data = Data::b(Data::agora());
$clientes = $db->select_rows($tabela, "$nome, $telefone, $datanascimento", "$datanascimento", "WHERE '$datanascimento' BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL 30 DAY");
?>
Nome: Telefone: Data de Nascimento: <br />
<?php
if (!$clientes) {
echo "Nao ha clientes cadastrados.";
}else {
foreach ($clientes as $cliente) {
if($cliente[$datanascimento] == $data) {
echo "<strong> $cliente[$nome] $cliente[$telefone] ".Data::m($cliente[$datanascimento])."</strong>";
}
else {
echo "$cliente[$nome] $cliente[$telefone] ".Data::m($cliente[$datanascimento]);
}
echo "<br />";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment