format("Y-m-d"); //https://www.youtube.com/watch?v=gNH6NNyhJLk //https://stackoverflow.com/questions/3179429/why-fpdf-library-fail-to-work-on-production-server //https://www.youtube.com/watch?v=EYYZFRRdR6A PDF with MySQL database $count = 0; require ('./fpdf.php'); // class PDF extends FPDF{ // function Header(){ // $this->Image('../images/ahg_logo.png',10,5, 25,10, 'PNG','wwww.autohubgroup.com'); // } // /* function Footer(){ // $this->SetY(-25); // $this->Image('../images/ahg_logo.png'); // } */ // } class PDF extends FPDF{ function Header() { $this->Image('../images/ahg_logo.png',10,5, 25,10, 'PNG','wwww.autohubgroup.com'); // Select Arial bold 15 $this->SetFont('Arial','B',15); // Move to the right $this->Cell(80); // Framed title //$this->Cell(50,10,'Dokumen ini sah',1,0,'C'); // Line break $this->Ln(20); } } $myUID = $_GET['id']; include_once("../../../cfg/conn.php"); include ("../functions/users.php"); $sql ="SELECT * FROM pms_group_tbl WHERE deleted=0 ORDER BY name ASC"; $getName = "SELECT * FROM pms_users WHERE id = $myUID LIMIT 1"; $getMyName = mysqli_query($conn,$getName); while($nRow = mysqli_fetch_array($getMyName)){ $fname=$nRow['f_name']; $lname=$nRow['l_name']; $myFName = $fname ." ". $lname; } $pdf = new PDF(); //set margins $pdf->SetMargins(10,20,10); $pdf->AddPage(); //set column size in array format $width_cell = array(20,40,50,80); $height_cell= 7; //set Image //$pdf->Image('../images/ahg_logo.png',10,5, 25,10, 'PNG','wwww.autohubgroup.com'); //background color $pdf->SetFillColor(255,255,255); //use for report title bgcolor $pdf->SetFont('Arial','B',12); $pdf->MultiCell(0,6,"GROUP SUMMARY LIST",0,0,'C',true); $pdf->SetFont('Arial','',8, 'landscape'); $pdf->SetFillColor(70, 70, 68 ,0); //use for header bgcolor $pdf->SetTextColor(255,255,255,90); $pdf->SetLineWidth(0); $pdf->SetDrawColor(0,0,25); //header start $pdf->Cell($width_cell[0],$height_cell,'ID',1,0,'L',true); $pdf->Cell($width_cell[1],$height_cell,'CODE',1,0,'L',true); $pdf->Cell($width_cell[2],$height_cell,'NAME',1,0,'L',true); $pdf->Cell($width_cell[3],$height_cell,'DESCRIPTION',1,0,'L',true); $pdf->SetFillColor(255,255,255,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $fill=false; //$pdf->Cell(400,200,'Hello Arnel'); $getArea = mysqli_query($conn,$sql); $statRow = mysqli_num_rows($getArea); if($statRow > 0){ while($row = mysqli_fetch_array($getArea)){ $count =$count + 1; $pdf->MultiCell(0,$height_cell,"",1,'L',$fill); //setup row padding $pdf->Cell($width_cell[0],$height_cell,$count,1,0,'L',$fill); $pdf->Cell($width_cell[1],$height_cell,$row['code'],1,0,'L',$fill); $pdf->Cell($width_cell[2],$height_cell,$row['name'],1,0,'L',$fill); $pdf->Cell($width_cell[3],$height_cell,$row['description'],1,0,'L',$fill); $fill =!$fill; // use code to put alternate color between rows } $pdf->MultiCell(1,25,"",0,'L',false); //setup row padding $pdf->Cell(100,0,"_____________________________",0,1,'L',false); $pdf->Cell(100,8,$myFName .' / '. $prfDateX ,0,0,'L',false); } $pdf->Output('my_file.php','I'); ?>