<?php
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");

(isset($_GET['pg'])) ? $pg = $_GET['pg'] : $pg = '';

if ($pg == 'hapus') {
	$id = $_POST['id'];
$exec = mysqli_query($koneksi, "DELETE FROM bel WHERE id='$id'");
	
}
if ($pg == 'tambah') {
	$hari = $_POST['hari'];
	$jam = $_POST['jam'];
	$menit = $_POST['menit'];
	$bel = $hari."".$jam."".$menit;
      $data = [
	    'hari'=> $_POST['hari'],
	   'haribell'=> $bel,
      'jam'=> $_POST['jam'],
	  'menit'=> $_POST['menit'],
	  'lagu'=> $_POST['lagu']
	];
$exec=insert($koneksi,'bel',$data);
}
if ($pg == 'edit') {
	$id = $_POST['id'];
     $hari = $_POST['hari'];
	$jam = $_POST['jam'];
	$menit = $_POST['menit'];
	$bel = $hari."".$jam."".$menit;
      $data = [
	    'hari'=> $_POST['hari'],
	   'haribell'=> $bel,
      'jam'=> $_POST['jam'],
	  'menit'=> $_POST['menit'],
	  'lagu'=> $_POST['lagu']
	];
$exec=update($koneksi,'bel',$data,['id'=>$id]);
}