<?php

	$con = @mysqli_connect("localhost", "root", "abc456", "Production") 
                   or die(mysqli_connect_error());
	mysqli_query($con,"set names utf8"); 
	
	$sql='SELECT * FROM asset WHERE TRIM(categories)="คอมพิวเตอร์" ';
	$result=mysqli_query($con,$sql);
	
	require("fpdf/fpdf.php");
	$pdf=new FPDF();
	///var_dump(get_class_methods($pdf));
	
	$pdf->AddPage();
	$pdf->AddFont('courier','','courier.php');
	
	// $pdf->Image('alen.jpg');
	$pdf->SetFont("courier","B","20");
	$pdf->Cell(0,10,iconv("UTF-8","","พัสดุ"),1,1,"C");

	$pdf->SetFont("courier","I","15");
	$pdf->Cell(0,10,"ชื่อ  Brand Model Description Owner Due Date Company Status",1,1,"C");
	
	$pdf->SetFont("courier","","12");
	while($data=mysqli_fetch_array($result))
		{		
			$pdf->write(5,"$data[names]","$data[brand]","$data[models]","$data[descriptions]",	                                      "$data[owners]","$data[retire]","$data[companies]","$data[status]");								
		}
		$pdf->Output();		
?>