Saya mau tanya min.. say amu menampilkan data ke dalam menu admin tpi error kaya gini

Notice: Undefined variable: conn in C:\xampp\htdocs\Zakat\admin\mod-amil\dataamil.php on line 3

Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\Zakat\admin\mod-amil\dataamil.php on line 3

ini min script.nya
  1. <?php
  2. try{
  3. $queryamil = $conn->prepare("SELECT * FROM amil");
  4. $queryamil->execute();
  5. $rsamil=$queryamil->fetch(PDO::FETCH_ASSOC);
  6. }
  7. catch (PDOException $e) {
  8. echo $e->getMessage();
  9. }
  10. ?>
  11. <style type="text/css">
  12. body,td,th {
  13. color: #000;
  14. }
  15. </style>
  16.  
  17. <h3>Data amil</h3>
  18. <a href="?mod=mod-amil/simpanamil">+Tambah Data</a>
  19. <table width="100%" border="1" cellpadding="5" cellspacing="0">
  20. <tr>
  21. <th>No</th>
  22. <th>Id Amil</th>
  23. <th>Nama Amil</th>
  24. <th>Alamat Amil</th>
  25. <th>Aksi</th>
  26. </tr>
  27. <?php $no=1; do{ ?>
  28. <tr>
  29. <td><?php echo $no++; ?></td>
  30. <td><?php echo $rsamil['id_amil']; ?></td>
  31. <td><?php echo $rsamil['nama_amil']; ?></td>
  32. <td><?php echo $rsamil['alamat_amil']; ?></td>
  33. <td><a href="?mod=mod-amil/detilamil&id_amil=<?php echo $rsamil['id_amil']; ?>">Detil |</a>
  34. <a href="?mod=mod-amil/editamil&id_amil=<?php echo $rsamil['id_amil']; ?>">Edit|</a>
  35. <a href="?mod=mod-amil/aksiamil&id_amil=<?php echo $rsamil['id_amil']; ?>&del=y" onClick="return confirm('Apakah anda mau menghapus data <?php echo addslashes ($rsamil['nama_amil']);?>?')" >Hapus|</a></td>
  36. </tr>
  37. <?php }while($rsamil=$queryamil->fetch(PDO::FETCH_ASSOC)); ?>
  38. </table>
14850
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification
User Paling Aktif Bulan Lalu

Asrianor

Point Bulan Lalu: 6