echo "Gagal:Db Error" . $strIns . "__" . mysql_error(); } } break; case 'edit': $strEdt = "update " . $dbname . ".kebun_5hargabibit set hargasatuan='" . $hargasatuan . "' where regional='" . $regional . "' and status='" . $status . "' and periode='" . $periode . "'"; if (mysql_query($strEdt)) { loadlist(); } else { echo "Gagal:Db Error" . $strEdt . "__" . mysql_error(); } break; case 'delete': $str = "delete from " . $dbname . ".kebun_5hargabibit where regional='" . $regional . "' and status='" . $status . "' and periode='" . $periode . "'"; if (mysql_query($str)) { loadlist(); } else { echo "Gagal:Db Error" . $str . "__" . mysql_error(); } break; default: break; } function loadlist() { global $conn; global $dbname; global $pages; echo "<div id=container>\r\n\t\t<table class=sortable cellspacing=1 cellpadding=3 border=0>\r\n\t\t\t<thead>\r\n\t\t\t<tr class=rowheader>\r\n\t\t\t <td>" . $_SESSION['lang']['regional'] . "</td>\r\n\t\t\t <td>" . $_SESSION['lang']['status'] . "</td>\r\n\t\t\t <td>" . $_SESSION['lang']['periode'] . "</td>\r\n\t\t\t <td>" . $_SESSION['lang']['hargasatuan'] . "</td>\r\n\t\t\t <td colspan='2' style='text-align:center;'>" . $_SESSION['lang']['action'] . "</td>\r\n\t\t\t</tr>\r\n\t\t\t</thead>\r\n\t\t\t<tbody>"; $limit = 12; $page = 0;
<?php if ($_COOKIE['user'] == '') { header("Location: index.php"); } include_once 'config.php'; $f = $_POST['f']; switch ($f) { case 'insert': insert($_POST['day'], $_POST['month'], $_POST['year']); break; case 'list': loadlist($_POST['year']); break; case 'delete': delete($_POST['ferieid']); break; } ////////////////functions/////////////////////////// function loadlist($year) { $thismonth = date("m"); $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB); $query = sprintf("SELECT * FROM `feries` WHERE `year`='%s' ORDER BY `year`,`month`,`day` ASC", $year); $result = $mysqli->query($query); while ($row = $result->fetch_object()) { if ($row->month >= $thismonth) { $trash = "<a href='javascript:deleteferie(" . $row->ferieid . ");'><img src='img/trash.png'/></a>"; } else { $trash = ""; }