Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $koneksi = new mysqli("localhost","root","","koperasi_pkm");
- $content = '
- <style type="text/css">
- .tabel{border-collapse: collapse;}
- .tabel th{padding: 8px 5px; background-color: #cccccc;}
- .tabel td{padding: 8px 5px;}
- </style>
- ';
- $content .= '
- <page>
- <h2> Laporan Data Anggota </h2>
- <table border="1" class="tabel">
- <tr>
- <th>No</th>
- <th>No Nasabah</th>
- <th>Nama Nasabah</th>
- <th>Alamat</th>
- <th>No HP</th>
- <th>Jenis Keanggotaan</th>
- <th>Departemen</th>
- <th>Tanggal Masuk</th>
- </tr>';
- $no = 1;
- $sql = $koneksi->query("select * from anggota");
- while ($data=$sql->fetch_assoc()) {
- $content .='
- <tr>
- <td>'.$no++.'</td>
- <td>'.$data['id'].'</td>
- <td>'.$data['nama'].'</td>
- <td>'.$data['alamat'].'</td>
- <td>'.$data['no_hp'].'</td>
- <td>'.$data['jenis_keanggotaan'].'</td>
- <td>'.$data['departemen'].'</td>
- <td>'.date('d F Y', strtotime($data['tgl_masuk'])).'</td>
- </tr>
- ';
- }
- $content.='
- </table>
- </page>';
- require_once('../assets/html2pdf/html2pdf.class.php');
- $html2pdf = new HTML2PDF('P','A4', 'fr');
- $html2pdf->WriteHTML($content);
- $html2pdf->Output('exemple.pdf');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment