<?php
 require('../vendor/autoload.php');
$con=mysqli_connect("localhost","root","","seven_hills");
$res=mysqli_query($con,"select * from product");

if(mysqli_num_rows($res)>0) {
    $html='<h2 style="text-align:center">Seven Hills International Ltd.</h2>';
    $html.='<h3 style="text-align:center">Product Invoice</h3>';
	$html.='<table style="text-align:center">';
          $html.='<tr style="text-align:center"><td>ID</td><td>Category</td><td>Name</td><td>Image</td></tr>';

          while($row=mysqli_fetch_assoc($res)){
          	 $html.='<tr><td>'.$row['id'].'</td><td>'.$row['categories'].'</td><td>'.$row['name'].'</td><td>'.$row['image'].'</td></tr>';
          }

	$html.='</table>';
	
}
else{
    $html="Data not found";
}

  $mpdf=new \Mpdf\Mpdf();
  $mpdf->WriteHTML($html);
  $file=time().'.pdf';
  $mpdf->output($file,'I');

?>