30 lines
741 B
PHP
30 lines
741 B
PHP
<?php
|
|
class Agama extends MY_Controller
|
|
{
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
function list() {
|
|
$sql = "select * from m_religion";
|
|
$qry = $this->db_smartone->query($sql);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
echo json_encode($rows);
|
|
} else {
|
|
echo json_encode(array());
|
|
}
|
|
}
|
|
function get($id) {
|
|
$sql = "select * from m_religion where M_ReligionID=?";
|
|
$qry = $this->db_smartone->query($sql,$id);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
echo json_encode($rows);
|
|
} else {
|
|
echo json_encode(array());
|
|
}
|
|
}
|
|
}
|
|
?>
|