Problem Generating PDF report using SQL fromdate to todate

Viewed 23

I have a problem generating transaction data for specific dates, when I choose the date range it generates all transactions mostly outside the dates I choose. I'm using TCPDF here's my code

$pdf->writeHTML($html, true, 0, true, true);

$html = '
<span style="text-align:center;">

<br>
<br>

<b style="font-size:16; color: black;"><span>EXPENSES REPORT<span></b>

<p style="text-align:center; font-size: 12">Date: '.$from.' - '.$to.'</p>

</span>
<br>

<p style="text-align:left; font-size: 14">Expenses</p>

';

$pdf->writeHTML($html, true, 0, true, true);
// create some HTML content
$pdf->SetFont('Times', '', 13);

// set core font

$date = date("d-m-Y");
$html = '

<table style="background-color:#F3F3F3;">
<tr style="background-color:#F3F3F3;">
<td  width="50px">S/NO</td>
<td><b>Date</b></td>
<td><b>Type</b></td>
<td width="250px"><b>Description</b></td>
<td><b>Credit</b></td>
<td><b>Debit</b></td>
<td><b>Balance</b></td>
</tr><table>
';
$pdf->writeHTML($html, true, 20, true, false);
$i=1;
$cq = $dBASE->query("SELECT * FROM ex_transaction WHERE ondate BETWEEN '$from' AND '$to'  ");
$ccount = $cq->num_rows;


  while($row = $cq->fetch_assoc()) 
    {
0 Answers
Related