Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- $query = "SELECT * FROM tek_rekap_mhs ORDER BY no";
- $sql = mysql_query ($query);
- $data = array();
- while ($row = mysql_fetch_assoc($sql)){
- array_push($data, $row);
- }
- $judul = "Rekapitulasi Jumlah Mahasiswa";
- $header = array(
- array("label"=>"No", "length"=>25, "align"=>"C"),
- array("label"=>"Jurusan", "length"=>100, "align"=>"C"),
- array("label"=>"Jumlah Mahasiswa", "length"=>50, "align"=>"C"),
- );
- require_once ("fpdf17/fpdf.php");
- $pdf = new FPDF();
- $pdf->AddPage();
- $pdf->SetFont('Arial','B','16');
- $pdf->Cell(0,20, $judul, '0', 1, 'C');
- $pdf->SetFont('Arial','','10');
- $pdf->SetFillColor(79,79,87);
- $pdf->SetTextColor(255);
- $pdf->SetDrawColor(79,79,87);
- foreach ($header as $kolom) {
- $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true);
- }
- $pdf->Ln();
- $pdf->SetFillColor(199,200,203);
- $pdf->SetTextColor(0);
- $pdf->SetFont('');
- $fill=false;
- foreach ($data as $baris) {
- $i = 0;
- foreach ($baris as $cell) {
- $pdf->Cell($header[$i]['length'], 5, $cell, 1, '0', $i==1?"L":$kolom['align'], $fill);
- $i++;
- }
- $fill = !$fill;
- $pdf->Ln();
- }
- $pdf->Output();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment