function get_kartukeluarga_id($nik) { $sql = "select keluarga_id from penduduk where nik = '{$nik}'"; $connection = MysqlManager::get_connection(); $result = $connection->query($sql); check_error($connection); $row = $result->fetch_object(); MysqlManager::close_connection($connection); return $row->keluarga_id; }
function get_alamat_id($sql) { if (strlen($sql) == 0) { return ""; } $conn = MysqlManager::get_connection(); $result = $conn->query($sql); $row = $result->fetch_array(); MysqlManager::close_connection($conn); return $row['id']; }
public function get_penduduk_id($nik) { $connection = MysqlManager::get_connection(); $result = $connection->query("select id from penduduk where nik = '{$nik}'"); $id = null; if ($result) { $row = $result->fetch_object(); $id = $row->id; } MysqlManager::close_connection($connection); return $id; }
function retrieve_data() { $connection = MysqlManager::get_connection(); $result = $connection->query($this->sql); check_error($connection); $row = $result->fetch_object(); $this->nik = $row->nik; $this->nama = $row->nama; $this->jenis_kelamin = $row->jenis_kelamin; $this->photo = $row->photo; $this->status_nikah = $row->status_nikah; $this->gol_darah = $row->gol_darah; $this->tempat_lahir = $row->tmp_lahir; $this->tgl_lahir = $row->tgl_lahir; $this->agama = $row->agama; $this->pendidikan = $row->pendidikan; $this->pekerjaan = $row->pekerjaan; $this->keluarga_id = $row->keluarga_id; $this->wni = $row->wni; // -- $sql = "select alamat_id from keluarga where id = {$this->keluarga_id}"; $result = $connection->query($sql); check_error($connection); $alamat_id = $result->fetch_object()->alamat_id; $sql = "select a.alamat as alamat, a.rukun_tetangga as rt, a.rukun_warga as rw,\r\r\n kel.nama_kelurahan as kelurahan, kec.nama_kecamatan as kecamatan, kec.kodepos as kodepos \r\r\n from alamat a, kelurahan kel, kecamatan kec where a.id = {$alamat_id} and a.kelurahan_id = kel.id and\r\r\n kel.kecamatan_id = kec.id "; $result = $connection->query($sql); check_error($connection); $row = $result->fetch_object(); $this->alamat = $row->alamat; $this->rt = $row->rt; $this->rw = $row->rw; $this->kelurahan = $row->kelurahan; $this->kecamatan = $row->kecamatan; $this->kodepos = $row->kodepos; MysqlManager::close_connection($connection); }
break; case "edit": $username = $_POST['username']; $password = $_POST['password']; $id = $_POST['id']; $sql = "update users set username = '******', password = password('{$password}') where id = {$id}"; $connection->query($sql); check_error($connection); MysqlManager::close_connection($connection); break; case "del": $id = $_POST['id']; $sql = "delete from users where id = {$id}"; $connection->query($sql); check_error($connection); MysqlManager::close_connection($connection); break; } } if (isset($_POST['data'])) { $data_request = $_POST['data']; switch ($data_request) { case 1: // already exist a user if (isset($_SESSION['user'])) { $menus = retrieve_menus(); $user = $_SESSION['user']; $resp = array('result' => 1, 'menu' => $menus, 'user' => $user); echo json_encode($resp); } else { // no user exist in session
private function get_orang_tua($id) { $resp = array(); if (strlen($id) > 0) { $sql = "select p.nama as ayah, pp.nama as ibu from penduduk p, penduduk pp,\r\n orang_tua o where p.id = o.bapak_id and pp.id = o.ibu_id and o.id = {$id}"; $conn = MysqlManager::get_connection(); $result = $conn->query($sql); check_error($conn); $row = $result->fetch_object(); $resp["ayah"] = $row->ayah; $resp["ibu"] = $row->ibu; MysqlManager::close_connection($conn); } else { $resp["ayah"] = ""; $resp["ibu"] = ""; } return $resp; }
public function retrieve_data() { $conn = MysqlManager::get_connection(); $sql = "select n.no_pernikahan as nomor_pernikahan, n.tanggal as tanggal,\n n.wali as wali, p.nama as pria, p.wni as wni_pria, a.agama as agama_pria,\n pp.nama as wanita, pp.wni as wni_wanita, aa.agama as agama_wanita from pernikahan n,\n penduduk p, penduduk pp, agama a, agama aa where n.id = {$this->id} and\n n.pria = p.id and n.wanita = pp.id and p.agama_id = a.id and pp.agama_id = aa.id"; $result = $conn->query($sql); check_error($conn); $row = $result->fetch_object(); $this->pria = $row->pria; $this->no_pernikahan = $row->nomor_pernikahan; $this->tanggal_menikah = $row->tanggal; $this->wali = $row->wali; $this->pria_agama = $row->agama_pria; $this->pria_wni = $row->wni_pria; $this->wanita = $row->wanita; $this->wanita_agama = $row->agama_wanita; $this->wanita_wni = $row->wni_wanita; MysqlManager::close_connection($conn); }
public function retrieve_data() { $conn = MysqlManager::get_connection(); $sql = "select p.nik as nik, p.nama as nama, p.tmp_lahir as tempat_lahir, p.tgl_lahir as tgl_lahir, \r\n p.jenis_kelamin as jenis_kelamin, p.wni as wni, \r\n a.no_akta as no_akta, a.created_at as tanggal_pembuatan, pp.nama as ayah, ppp.nama as ibu \r\n from penduduk p, penduduk pp, penduduk ppp, akta_kelahiran a, orang_tua o where p.id = " . $this->id . " and p.id = a.penduduk_id and p.orangtua_id = o.id and o.bapak_id = pp.id and o.ibu_id = ppp.id"; $result = $conn->query($sql); check_error($conn); $row = $result->fetch_object(); $this->nik = $row->nik; $this->nama = $row->nama; $this->tempat_lahir = $row->tempat_lahir; $this->tanggal_lahir = $row->tgl_lahir; $this->jenis_kelamin = $row->jenis_kelamin; $this->wni = $row->wni; $this->no_akta = $row->no_akta; $this->tanggal_pembuatan = $row->tanggal_pembuatan; $this->ayah = $row->ayah; $this->ibu = $row->ibu; MysqlManager::close_connection($conn); }
function get_setting_value($key) { $conn = MysqlManager::get_connection(); $sql = "select * from settings where name = '{$key}'"; $result = $conn->query($sql); check_error($conn); $row = $result->fetch_object(); $dataType = $row->type_value; $val = ""; switch ($dataType) { case "varchar": $val = $row->varchar_value; break; case "int": $val = $row->int_value; break; case "datetime": $val = $row->datetime_value; break; case "date": $val = $row->date; break; case "double": $val = $row->double; break; } MysqlManager::close_connection($conn); return $val; }