Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to list 15 days remaing registers ['com_exception' ]

New Here ,
Dec 05, 2009 Dec 05, 2009

Dears Sirs,

I've been trying to list 15 days remaing announcements registered on access database using PHP and SQL routines.

I've sucess when doing a quey "select * from BD" without other codes.

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

Code:

<?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 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();
?>
TOPICS
Server side applications
345
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 05, 2009 Dec 05, 2009
LATEST

I've have no idea if this is it, but queries for MS Access require hash (#) surrounding dates. Try that and see.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines