endang_nuradi

laporan_anggota_pdf_semua

Jan 27th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <?php
  2. $koneksi = new mysqli("localhost","root","","koperasi_pkm");
  3. $content = '
  4. <style type="text/css">
  5. .tabel{border-collapse: collapse;}
  6. .tabel th{padding: 8px 5px; background-color: #cccccc;}
  7. .tabel td{padding: 8px 5px;}
  8.  
  9. </style>
  10. ';
  11.  
  12. $content .= '
  13.  
  14. <page>
  15. <h2> Laporan Data Anggota </h2>
  16. <table border="1" class="tabel">
  17. <tr>
  18. <th>No</th>
  19. <th>No Nasabah</th>
  20. <th>Nama Nasabah</th>
  21. <th>Alamat</th>
  22. <th>No HP</th>
  23. <th>Jenis Keanggotaan</th>
  24. <th>Departemen</th>
  25. <th>Tanggal Masuk</th>
  26. </tr>';
  27.  
  28. $no = 1;
  29.  
  30. $sql = $koneksi->query("select * from anggota");
  31.  
  32. while ($data=$sql->fetch_assoc()) {
  33. $content .='
  34. <tr>
  35. <td>'.$no++.'</td>
  36. <td>'.$data['id'].'</td>
  37. <td>'.$data['nama'].'</td>
  38. <td>'.$data['alamat'].'</td>
  39. <td>'.$data['no_hp'].'</td>
  40. <td>'.$data['jenis_keanggotaan'].'</td>
  41. <td>'.$data['departemen'].'</td>
  42. <td>'.date('d F Y', strtotime($data['tgl_masuk'])).'</td>
  43. </tr>
  44. ';
  45.  
  46. }
  47. $content.='
  48. </table>
  49.  
  50. </page>';
  51.  
  52. require_once('../assets/html2pdf/html2pdf.class.php');
  53. $html2pdf = new HTML2PDF('P','A4', 'fr');
  54. $html2pdf->WriteHTML($content);
  55. $html2pdf->Output('exemple.pdf');
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment