Title1

Title2

Title3

12-8  op_delete()

 程式:op_delete()

#################################
# 刪除資料
#
#################################
function op_delete($sn = "") {
	global $mysqli;
	if (!$sn) {
		redirect_header("index.php", 3000, "刪除記錄錯誤!!");
	}

	#檢查
	$sql = "delete
          from `creative_nav`
          where `sn`='{$sn}'"; //die($sql);
	$mysqli->query($sql) or die(printf("Error: %s <br>" . $sql, $mysqli->sqlstate));

	return;
}

樣板:
op_list
sweet-alert套件:https://lipis.github.io/bootstrap-sweetalert/

下載:https://github.com/lipis/bootstrap-sweetalert/tree/master/dist


  <link rel="stylesheet" href="<{$smarty.const.WEB_URL}>/class/sweetalert/sweetalert.css" type="text/css">
  <script src="<{$smarty.const.WEB_URL}>/class/sweetalert/sweetalert.min.js" type="text/javascript"></script>
  <script type="text/javascript"> 
    function op_delete_js(sn){
      //警告視窗
      swal({
        title: '確定要刪除此資料?',
        text: '相關資料通通都將會被移除!',
        type: 'warning',
        showCancelButton: 1,
        confirmButtonColor: '#DD6B55',
        confirmButtonText: '確定刪除!',
        closeOnConfirm: false ,
        allowOutsideClick: true
      },
      function(){//確定
        location.href="?op=op_delete&sn="+sn;
      });
    }
  </script>