move_uploaded_file($_FILES['HinhAnhUpload']['tmp_name'], dirname(dirname(__FILE__)) . "/image/" . $HinhAnh); } $TenHang = $_POST['TenHang']; $DVT = $_POST['DVT']; $DonGia = $_POST['DonGia']; $MaNhaCungCap = $_POST['MaNhaCungCap']; $MaLoaiHang = $_POST['MaLoaiHang']; $MoTa = $_POST['MoTa']; $sql_insert = "INSERT INTO `tbl_DMHang`(`TenHang`, `HinhAnh`, `DVT`, `DonGia`, `MaNhaCungCap`, `MaLoaiHang`, `MoTa`) \n\t\tVALUES (N'{$TenHang}',N'{$HinhAnh}',N'{$DVT}',N'{$DonGia}',N'{$MaNhaCungCap}',N'{$MaLoaiHang}',N'{$MoTa}')"; //echo $sql_insert; $result = execute($sql_insert); } $sql_loaihang = "SELECT * FROM `tbl_LoaiHang`"; $list_loaihang = select_array($sql_loaihang); $sql_ncc = "SELECT * FROM `tbl_NhaCungCap`"; $list_ncc = select_array($sql_ncc); $title_page = "Thêm Hàng Hóa"; include_once 'layout_header.php'; ?> <form action="hanghoa_add.php" method="POST" enctype="multipart/form-data"> <table class = "table table-bordered"> <tr> <td colspan="2" class="mauxam"><span>THÊM MỚI Hàng Hóa</span></td> </tr> <tr class="mauxanhduong"> <td>Tên Hàng</td> <td> <input type="text" name="TenHang"> </td> </tr> <tr class="mauxanhduong">
if (!empty($_GET['xoa']) && $_GET['xoa'] == 'true' && !empty($_GET['MaNhaCungCap'])) { $MaNhaCungCap = $_GET['MaNhaCungCap']; $sql_delete = "DELETE FROM `tbl_NhaCungCap` where MaNhaCungCap = '{$MaNhaCungCap}'"; $result = execute($sql_delete); if ($result == 'true') { echo "Đã Xóa thành công !!!!"; } } // hiển thị dữ liệu if (!empty($_GET['keywords'])) { $keywords = $_GET['keywords']; // SELECT * FROM `tbl_NhaCungCap` where `TenNhaCungCap` like '%tính%' or `DiaChi` like '%tính%' $where = "Where `TenNhaCungCap` like '%{$keywords}%' or `DiaChi` like '%{$keywords}%' or `MaNhaCungCap` = '{$keywords}'"; } $sql = "SELECT * FROM `tbl_NhaCungCap` {$where}"; $data = select_array($sql); $title_page = "Quản lí Nhà Cung Cấp"; include_once 'layout_header.php'; ?> <table class = "table table-bordered"> <tr> <td colspan="6" class="mauxam"><span>QL NHÀ CUNG CẤP</span></td> </tr> <tr> <td colspan="6" class="mauxam"> <form action="nhacungcap_list.php" method="GET"> <span>Từ khóa</span> <input type="text" class="keywords" name="keywords"> <button type="submit" value="Tìm" class="btn btn-default">Tìm</button> </form> </td>