<?php
function ftab($db_stat, $tname, $colname) {
    require 'data.php';

    $fdb = "SELECT ".$db_stat." FROM ".$tname." LIMIT 1";
    $qdb = mysqli_query($data, $fdb);

    if(mysqli_num_rows($qdb) > 0) {
        $fetch = mysqli_fetch_assoc($qdb);
        return html_entity_decode($fetch[$colname]);
    }


}

function fwtab($db_stat, $tname, $colname, $cond1, $cond2) {
    require 'data.php';
  
    $fdb = "SELECT ".$db_stat." FROM ".$tname." WHERE ".$cond1." = '".$cond2."' ";
    $qdb = mysqli_query($data, $fdb);
  
    if(mysqli_num_rows($qdb) > 0) {
        $fetch = mysqli_fetch_assoc($qdb);
        echo html_entity_decode($fetch[$colname]);
    }
  
  
  }

  function timeindo($jamnya) {
    $hari = date("l", strtotime($jamnya));

    switch($hari){
        case 'Monday':
            return 'Senin';
        break;

        case 'Tuesday':
            return 'Selasa';
        break;

        case 'Wednesday':
            return 'Rabu';
        break;

        case 'Thursday':
            return 'Kamis';
        break;

        case 'Friday':
            return 'Jumat';
        break;

        case 'Saturday':
            return 'Sabtu';
        break;

        case 'Sunday':
            return 'Minggu';
        break;
    }

}

function monthindo($jamnya) {
    $hari = date("F", strtotime($jamnya));

    switch($hari){
        case 'January':
            return 'Januari';
        break;

        case 'February':
            return 'Februari';
        break;

        case 'March':
            return 'Maret';
        break;

        case 'April':
            return 'April';
        break;

        case 'May':
            return 'Mei';
        break;

        case 'June':
            return 'Juni';
        break;

        case 'July':
            return 'Juli';
        break;

        case 'August':
            return 'Agustus';
        break;

        case 'September':
            return 'September';
        break;

        case 'November':
            return 'November';
        break;

        case 'December':
            return 'Desember';
        break;
    }
}

?>