<?php
include('includes/config.php');


$ftdate = '2019-01-30';
$ffdate = '2019-02-05';

$ftdate = date('Y-m-d',strtotime($ftdate));
$ffdate = date('Y-m-d',strtotime($ffdate));


$sql = "SELECT tblvehicles.name,tblvehicles.dob,tblvehicles.gnum,tblvehicles.address,tbllogs.status,tbllogs.date from tblvehicles join tbllogs on tblvehicles.id=tbllogs.idnum where tbllogs.date between "."'$ftdate'"." AND "."'$ffdate'";

$query = $dbh -> prepare($sql);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;

echo $sql;
echo "<br/>";

if($query->rowCount() > 0)
{
foreach($results as $result)
{			

echo "name: ".$result->name;

	echo "hello";						

?>	 

								

										<tr>

											<td><?php echo htmlentities($cnt);?></td>
											<td><?php echo htmlentities($result->name);?></td>
										   <td><?php echo htmlentities($result->dob);?></td>
											<td><?php echo htmlentities($result->gnum);?></td>
											<td><?php echo htmlentities($result->address);?></td>
											<td><?php echo htmlentities($result->status);?></td>
											<td><?php echo htmlentities($result->date);?></td>
								
										</tr>

	
									

										<?php $cnt=$cnt+1; }}
									 else {
											echo "error";
										} ?>


