Dears Sirs,
I'm brazillian, sorry my horrible english.
I've been trying to do a quey that shows registers with 15 days remaining
----------------
I see an error:
1261306544
2009/12/20
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Unknown<br/><b>Description:</b> Unknown' in C:\wd\xampp\htdocs\nf\admin\consulta_vencendo.php:9 Stack trace: #0 C:\wd\xampp\htdocs\nf\admin\consulta_vencendo.php(9): com->Execute('select * from P...') #1 {main} thrown in C:\wd\xampp\htdocs\nf\admin\consulta_vencendo.php on line 9
And the code is:
<?php
//Eu preciso fazer uma consulta onde me mostre apenas os registros que irão vencer nos proximos 15 dias
$conexao = new COM("ADODB.Connection");
$conexao->Open(((((("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\wd\\negociofeito\\admin\\dat\\bd.mdb"))))));
$timestamp = strtotime('+15 days'); // soma 15 dias a data atual
$comp = date('Y/m/d', $timestamp); //grava a data com 15 dias somados
print $timestamp . "<br/>";
print $comp;
$recordset = $conexao->Execute("select * from PRO where (STR_TO_DATE('PRO_DTCAD','Y/m/d') + current_date) >= current_date AND (STR_TO_DATE('PRO_DTCAD','Y/m/d') + current_date) <='$comp'");
echo "CÓDIGO" . " | " . "NOME" . " | " . "PREÇO" . " | " . "DATA CADASTRO" . " | " . "DURAÇÃO ANÚNCIO" . "<BR/>";
while (!$recordset->EOF) {
echo " | " . $recordset->fields["PRO_COD"]->value;
echo " | " . $recordset->fields["PRO_NOME"]->value;
echo " | " . $recordset->fields["PRO_PRECO"]->value;
echo " | " . $recordset->fields["PRO_DTCAD"]->value;
echo " | " . $recordset->fields["PRO_DURAC"]->value;
echo "<br/>";
$recordset->MoveNext();
}
$conexao->Close();
?>