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.
30 lines
690 B
PHP
30 lines
690 B
PHP
<?php
|
|
session_start();
|
|
if($_SESSION['validUser'] !== TRUE)
|
|
{
|
|
header("location: ./index.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<?php
|
|
$harray = array();
|
|
/* konfigurasi untuk koneksi ke database */
|
|
require_once 'db_login.inc.php';
|
|
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
|
|
$data = $mysqli->query("SELECT kd_strip,nama_strip FROM strip ORDER BY nama_strip");
|
|
if($data->num_rows > 0)
|
|
{
|
|
$idx = 0;
|
|
while($ket = $data->fetch_array(MYSQLI_ASSOC))
|
|
{
|
|
$harray[$idx] = array('kd_strip' => $ket['kd_strip'],'nama_strip' => $ket['nama_strip']);
|
|
$idx += 1;
|
|
}
|
|
/* tutup hasil query */
|
|
$data->close();
|
|
}
|
|
/* tutup koneksi */
|
|
$mysqli->close();
|
|
/* cetak hasil */
|
|
echo json_encode($harray);
|