update_menu_process.php 1007 Bytes
Newer Older
DESKTOP-4R50ASQ\DELL committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<?php

session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';



if (!empty($_FILES['uploaded_file'])) {
    $path = "foto/";
    $path = $path . basename($_FILES['uploaded_file']['name']);
    if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
        echo "The file " . basename($_FILES['uploaded_file']['name']) .
        " has been uploaded";
    } else {
        echo "There was an error uploading the file, please try again!";
    }
}
$id = $_GET['id'];
//die($id);
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$deskripsi = $_POST['deskripsi'];
$id_karyawan = get_session('id');
$gambar = basename($_FILES['uploaded_file']['name']);



$sql = "UPDATE menu SET nama='$nama', harga='$harga', deskripsi='$deskripsi', id_karyawan=$id_karyawan, gambar='$gambar' WHERE id=$id";

31
if ($conn->query($sql) === TRUE) {
DESKTOP-4R50ASQ\DELL committed
32 33
    echo "Record updated successfully";
} else {
34
    echo "Error updating record: " . $conn->error;
DESKTOP-4R50ASQ\DELL committed
35 36 37 38 39 40
}



redirect('index.php');
?>