www
/
wwwroot
/
magazinmiorita.be
/
admin
➕ New
📤 Upload
✎ Editing:
products.php
← Back
<?php include('../includes/inc.config.php'); include('check_session.php'); $limit = 15; $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]); $startpoint = ($page * $limit) - $limit; $search = ($_GET['search'] ? 'search='.$_GET['search'].'&' : ''); $url = '?'.$search.'page='; if(isset($_GET['action']) && $_GET['action'] == 'delete'){ $del_product = $database->execute("DELETE FROM `products` WHERE `id` = '".$_GET['id']."'"); if($del_product){ $_SESSION['message'] = 'Product deleted successfully!'; $_SESSION['mtype'] = 'succ'; }else{ $_SESSION['message'] = 'Error! Product can not be deleted, please check and try again.'; $_SESSION['mtype'] = 'err'; } } if(isset($_GET['m']) && $_GET['m'] == 'ok'){ $_SESSION['message'] = 'Product update successfully!'; $_SESSION['mtype'] = 'succ'; } $search = ''; if(isset($_GET['search']) && $_GET['search'] != '' || isset($_POST['search']) && $_POST['search'] != ''){ $src_key = ($_GET['search'] ? $_GET['search'] : $_POST['search']); $search = " WHERE `name` LIKE '%$src_key%' or `code` LIKE '%$src_key%' "; } $get_products_results = array(); $get_products = $database->execute("SELECT * FROM `products` {$search} LIMIT {$startpoint} , {$limit} "); $statement = ' `products` '.$search.' '; while($row = $database->fetch($get_products)){ $get_products_results[] = $row; } $smarty->assign('pagination', $data->apagination($statement,$limit,$page,$url)); $smarty->assign("message", $_SESSION['message']); $smarty->assign("type", $_SESSION['mtype']); $smarty->assign("products", $get_products_results); $smarty->display(END_PATH.'products.tpl'); ?>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel