<?php
// class Listdata {
//   // Properties
//   public $list;

//   // Methods
//   function set_list($list,$kondisi='') {
//   	include '../bilspro/config/connect.php';
//   	$listd = array();
// 	$ambil=mysqli_query($con,"SELECT * FROM $list $kondisi");
// 	while ($tiap = $ambil->fetch_assoc())
// 	{
// 	  $listd[] = $tiap;
// 	}
//     $this->list = $listd;
//   }
//   function get_list() {
//     return $this->list;
//   }
// }
?>

<?php
class Listdata {
  public $list;
  function set_list($list, $kondisi = '') {
    include '../bilspro/config/connect.php';
    $listd = array();
    $query = "SELECT * FROM $list $kondisi";
    try {
        $stmt = $pdo->prepare($query);
        $stmt->execute();
        while ($tiap = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $listd[] = $tiap;
        }
        $this->list = $listd;
    } catch (PDOException $e) {
        echo "Error: " . $e->getMessage();
    }
  }
  function get_list() {
    return $this->list;
  }
}
?>
