You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
644 B
PHP

<?php
session_start();
if($_SESSION['validUser'] !== TRUE)
{
header("location: ./index.php");
exit();
}
$harray = array();
/* konfigurasi untuk koneksi ke database */
require_once("../db_login.inc.php");
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
$data = $mysqli->query("SELECT DISTINCT(keterangan) FROM m_retur_beli");
if($data->num_rows > 0)
{
$idx = 0;
while($ket = $data->fetch_array(MYSQLI_ASSOC))
{
$harray[$idx] = array('keterangan' => $ket['keterangan']);
$idx += 1;
}
/* tutup hasil query */
$data->close();
}
/* tutup koneksi */
$mysqli->close();
/* cetak hasil */
echo json_encode($harray);