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

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();
?>

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

Similar Messages

Maybe you are looking for

  • Need help in understanding why so many gets and I/O

    Hi there, I have a sql file somewhat similar in structure to below: delete from table emp;-- changed to Truncate table emp; delete from table dept;--changed to Truncate table dept; insert into emp values() select a,b,c from temp_emp,temp_dept where t

  • Flash error from Captivated swf files

    I need to load swf files made in Captivate into a Flash file. Everything has gone smoothly except for a Multiple Choice quiz swf which shows this error in Flash: TypeError: Error #1009: Cannot access a property or method of a null object reference.  

  • Why i get this error

    When I Run my applet in the local computer It works fine but when I upload the applet in remote server and run the applet I get this error in Java console and the applet is not displayed...Will any one help me to solve the problem Thank u Vijay IOExc

  • Dynamic scroll bar not visible

    I created my text in a text file (saved as testtext.txt), then in Flash I added a dynamic text box (instance name: testtext) and dragged a scrollbar component (instance name: ttscroll) onto it. I then added this action script to the first frame: ttsc

  • Error while configuring owb respository

    i have oracle 9i v. 9.2.0.1.0 at server side and i have installed client for this at one cleint now whie i have tried to install owb 10g cleint at cleint pc and configure repository at client then it gives error after 94 % like the warehouse builder