document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2. class Produk{
  3.     var $koneksi;
  4.     var $base_url;
  5.     var $table=\'tb_produk\';
  6.  
  7.     function __construct($koneksi, $base_url){
  8.         $this->koneksi=$koneksi;
  9.         $this->base_url=$base_url;
  10.     }
  11.    
  12.     function getAllData(){
  13.         $no = 0;
  14.         $data = mysqli_query($this->koneksi,"select * from $this->table order by RAND()");
  15.         while($d = mysqli_fetch_array($data)){
  16.             $result[$no]=$d;
  17.             $no++;
  18.         }
  19.         return $result;
  20.     }
  21.  
  22.     function getAllByKategori($kategori){
  23.         $no = 0;
  24.         $data = mysqli_query($this->koneksi,"select * from $this->table where id_kategori=\'$kategori\' order by id desc");
  25.         while($d = mysqli_fetch_array($data)){
  26.             $result[$no]=$d;
  27.             $no++;
  28.         }
  29.         return $result;
  30.     }
  31.  
  32.     function getRupiahFormat($angka){
  33.         $result = "Rp. ".number_format($angka,2,\',\',\'.\');
  34.         return $result;
  35.     }
  36. }
  37. ?>
');