<?php checkauthentication(); $table = "tb_unitkerja"; $field = array("id", "kdunit", "nmunit", "sktunit", "kdsatker"); $err = false; $p = $_GET['p']; extract($_POST); $xusername_sess = $_SESSION['xusername']; $kddept = setup_kddept_keu(); $kdunitx = setup_kdunit_keu(); $xmenu_p = xmenu_id($p); $p_next = $xmenu_p->parent; if (isset($form)) { if ($err != true) { $lastmodified = now(); $modifiedby = $xusername_sess; $id = $q; foreach ($field as $k => $val) { $value[$k] = ${$val}; } if ($q == "") { //ADD NEW $sql = sql_insert($table, $field, $value); $rs = mysql_query($sql); if ($rs) { update_log($sql, $table, 1); $_SESSION['errmsg'] = "Input data berhasil!"; } else { update_log($sql, $table, 0); $_SESSION['errmsg'] = "Input data gagal!";
<?php checkauthentication(); $p = $_GET['p']; $cari = $_GET['cari']; $table = "t_satker"; $field = array("ID", "KDSATKER", "NMSATKER", "KDDEPT", "KDUNIT"); $ed_link = "index.php?p=" . get_edit_link($p); $del_link = "index.php?p=" . get_delete_link($p); $kddept = setup_kddept_keu($kode); $kdunit = setup_kdunit_keu($kode); #Halaman yang akan ditampilkan untuk pertengahan? $adjacents = 3; $query = "SELECT COUNT(*) as num FROM {$table} WHERE KDDEPT = '{$kddept}' AND KDUNIT = '{$kdunit}' AND (NMSATKER LIKE '%{$cari}%' OR KDSATKER LIKE '%{$cari}%' OR KDDEPT LIKE '%{$cari}%' OR KDUNIT LIKE '%{$cari}%') "; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; #variabel query $targetpage = "index.php?p={$p}&cari={$cari}"; #nama file (nama file ini) $limit = 20; #berapa yang akan ditampilkan setiap halaman $pagess = $_GET['pagess']; if ($pagess) { $start = ($pagess - 1) * $limit; } else { $start = 0; } #halaman awal $oList = mysql_query("SELECT * FROM {$table} WHERE KDDEPT = '{$kddept}' AND KDUNIT = '{$kdunit}' AND ( NMSATKER LIKE '%{$cari}%' OR KDSATKER LIKE '%{$cari}%' OR KDDEPT LIKE '%{$cari}%' ) ORDER BY KDSATKER LIMIT {$start}, {$limit}"); $count = mysql_num_rows($oList); while ($List = mysql_fetch_object($oList)) {