Reports not displaying properly


Iam trying to display the reports between two dates. It is not fetching the data correctly. I am using php with excel. If any of you had the same problem and got it rectified, please let me know.



Need code to be able to help you do anything…

 echo '<link rel="stylesheet" type="text/css" href="report.css"></head>'; 
 $fd = date('d/m/y',$_POST['fd']);
 $ld = date('d/m/y', $_POST['ld']);

echo $fd;
echo 'second';
echo $td;
$file1 = fopen("contacts.csv","r");

foreach ($array as $key=>$var)
echo "<div class='row'>
echo "<h2 align='center' class='blue'> Today's Records </h2>";
echo '<table class="samples">';
echo '<tr><th>Date</th>
    <th>Mobile Number</th>
	<th>Landline Number</th>
	<th>Machine Make</th>
	<th>Model/Product Code</th>
	<th>Service No.</th>
	<th>Express Code</th>
	<th>Problem Description</th>
 echo $fd;
   echo $td;
foreach ($array as $key=>$value)

  echo $i;
   echo '<tr class=d' . ($i & 1) . ' align="center">';
 //  $rd=date('d/m/y',strtotime($array[$key][0]));
   /* if date('d/m/y',strtotime($array[$key][0]))>=$fd && date('d/m/y',strtotime($array[$key][0]))<=$td)*/
	if (date('d/m/y',strtotime($array[$key][0]))>$fd && date('d/m/y',strtotime($array[$key][0]))<$td)
  echo $rd;
  echo date('d/m/y',strtotime($array[$key][0]));
  echo '<td class="w">' . $array[$key][0] . '</td>';
  echo '<td>' . $array[$key][1] . '</td>';
  echo '<td>' . $array[$key][2] . '</td>';
  echo '<td>' . $array[$key][3] . '</td>';
  echo '<td>' . $array[$key][4] . '</td>';
  echo '<td>' . $array[$key][5] . '</td>';
  echo '<td>' . $array[$key][6] . '</td>';
  echo '<td>' . $array[$key][7] . '</td>';
  echo '<td>' . $array[$key][8] . '</td>';
  echo '<td>' . $array[$key][9] . '</td>';
  echo '<td>' . $array[$key][10] . '</td>';
  echo '<td>' . $array[$key][11] . '</td>';
  echo '<td>' . $array[$key][12] . '</td>';
echo '</table>';



What isn’t being fetched properly?


it is displaying the records but the records within the dates are not displaying
It is showing the wrong records



In the image I tried to display the records between dec. 20th and jan 4th
but it is displaying august records

That is my problem


Why are you doing $array[$key]? If you want to go that route, use a for loop, otherwise you are not using the foreach properly.

What is the index of the key with the date? Or a subset of sample data so we can show you how.


$array[$key][0] is the index of date