Jump to content

ckbis1

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by ckbis1

  1. Hi

     

    I need to create a pdf report of one of my tables in my database, creating the pdf was easy just used fpdf, but what i am struggling with now is trying to generate that report on data for the past 30 days (i am trying to make a monthly report), my snap shot of my code follows:

     

    "

     

    echo $date = date("Y-m-d") ;

    echo $date2 = "select(DATESUB($date, INTERVAL 31 DAY)";

     

     

     

    $pdf->Table("select j_num, building,room, description,reason, type, contractors, staff, start_time, end_time, cost, note FROM job WHERE completed = 'yes' BETWEEN $date and $date2 ",$prop);

    $pdf->Output();

    ?>

     

    "

     

    the first echo gives me this - "2012-05-09" which is right i need the system date

    the second echo gives me this - "select(DATESUB(2012-05-09, INTERVAL 31 DAY)" which is wrong it should be minusing 30days from the system date

     

    THIS IS THE ENTIRE ERROR THAT I GET IN MY BROWSER:

     

    2012-05-09select(DATESUB(2012-05-09, INTERVAL 31 DAY)Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select(DATESUB(2012-05-09, INTERVAL 31 DAY)' at line 1

    Query: select j_num, building,room, description,reason, type, contractors, staff, start_time, end_time, cost, note FROM job WHERE completed = 'yes' BETWEEN 2012-05-09 and select(DATESUB(2012-05-09, INTERVAL 31 DAY)

     

     

    is there something wrong with my syntax? well i guess its kinda obvious there is, but what and any suggestions on how to fix it

     

     

    Thanx

    Chris

×
×
  • Create New...