Пример #1
0
<?php

if (isset($_POST['apa']) && $_POST['apa'] != "") {
    // include '../inc/tes.php';
    // include 'class.do.php';
    include 'do/class.do.php';
    $data = new do_do();
    switch ($_POST['apa']) {
        case 'help':
            if (isset($_POST['deskripsi']) && isset($_POST['tema']) && isset($_POST['ukuran']) && isset($_POST['jumlah']) && isset($_POST['ket'])) {
                if ($help = $data->runQuery("INSERT INTO `do_help`(`deskripsi`,`id_tema_layar`,`id_ukuran`, `jumlah`,`ket`) VALUES ('" . $_POST['deskripsi'] . "', '" . $_POST['tema'] . "', '" . $_POST['ukuran'] . "', '" . $_POST['jumlah'] . "', '" . $_POST['ket'] . "' ) ")) {
                    $id = $data->lastInsertID();
                    if ($cek = $data->runQuery("SELECT `do_help`.* , `tema_layar`.`tema`,`ukuran`.`pre`,`ukuran`.`panjang`,`ukuran`.`lebar` FROm `do_help` INNER JOIN `tema_layar` ON `tema_layar`.`id`=`do_help`.`id_tema_layar` INNER JOIN `ukuran` ON `ukuran`.`id` = `do_help`.`id_ukuran` WHERE `id` = '" . $id . "'")) {
                        if ($cek->num_rows > 0) {
                            $rs = $cek->fetch_array();
                            echo "<tr>\n\t\t\t\t\t\t\t\t<td>" . $rs['deskripsi'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . $rs['tema'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . $rs['pre'] . " " . $rs['panjang'] . " x " . $rs['lebar'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . $rs['jumlah'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . $rs['ket'] . "</td>\n\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t</tr>";
                        } else {
                            echo "<script>alert('Gagal menyimpan detail..');</script>";
                        }
                    } else {
                        echo "<script>alert('Gagal menyimpan detail..');</script>";
                    }
                } else {
                    echo "<script>alert('Gagal menyimpan detail..');</script>";
                }
            }
            break;
        case "simpan":
            $arr = array();
            if (isset($_POST['data-detail']) && $_POST['data-detail'] != "" && isset($_POST['idPelanggan']) && $_POST['idPelanggan'] != "" && isset($_POST['tglDO']) && $_POST['tglDO'] != "") {
                $idPelanggan = $_POST['idPelanggan'];