Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Bom dia,
Turma sou iniciante em programação com php e estou com um probleminha que esta me deixando de cabelo branco...
li e reli dicas e não funciona...
Estou tentando criar uma consulta em php ao banco dados por datas.
Quando coloco as data a ser consultada, me retorna nada informação zero.
o campo data no meu bd é formato date.
este é o meu codigo...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<style type="text/css">
.fontevoltar {
font-weight: bold;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Resultado</title>
<style type="text/css">
.tamanho {
font-size: 36px;
}
</style>
</head>
<body>
</div>
<div align="center"><strong class="tamanho">Consulta Sistema Recepção</strong>
</div>
<hr/>
</p>
<p> </p>
<div align="center">
<table width="1184" border="1">
<tr align="center" bgcolor="#C0C0C0" class="preto">
<td width="62"><strong class="preto">Data</strong></td>
<td width="74"><strong class="preto">Horário</strong></td>
<td width="83"><strong class="preto">Quem Ligou</strong></td>
<td width="89"><strong class="preto">Empresa</strong></td>
<td width="90"><strong class="preto">Para o Depto</strong></td>
<td width="100"><strong class="preto">Falar Com</strong></td>
<td width="150"><strong class="preto">Assunto</strong></td>
<td width="94"><strong class="preto">Status</strong></td>
<td width="132"><strong class="preto">Retorno</strong></td>
<td width="246"><strong class="preto">Observações</strong></td>
</tr>
<?php
include "conexao.php";
$consultar = date("Y-m-d", strtotime($_POST['data']));
$sql = mysql_query("SELECT * FROM `agenda` WHERE data = '$consultar'");
while($linha = mysql_fetch_array(@$sql)){
?>
<tr align="center">
<td><?=$data = $linha['data'];?></td>
<td><?=$horario = $linha['horario'];?></td>
<td><?=$ligacao = $linha['ligacao'];?></td>
<td><?=$empresa = $linha['empresa'];?></td>
<td><?=$depto = $linha['depto'];?></td>
<td><?=$funcionario = $linha['funcionario'];?></td>
<td><?=$assunto = $linha['assunto'];?></td>
<td><?=$status = $linha['status'];?></td>
<td><?=$retorno = $linha['retorno'];?></td>
<td><?=$observacao = $linha['obs'];?></td>
</tr>
<?php
} // Fecha loop agenda
?>
</table>
<td><div align="center"><a href="consulta.php"><strong>Voltar</strong></a></div>
</tr>
</table>
<div align="center"><a href="ligacoes.php"><strong>Exportar para Excel</strong></a></div>
</div>
</body>
</html>
onde estou errando?????
Ficarei muito grato pela ajuda.
Carregando comentários...