| Current Path : /home2/wtmwscom/www/admin/ |
| Current File : /home2/wtmwscom/www/admin/product_page_edit_model.php |
<?php
session_start();
include('../connection.php');
include '../function_lib.php';
include('imageresize.php');
if (isset($_POST['submit'])) {
if (!empty($_FILES['file']) && isset($_FILES['file']['name']) && array_search($_FILES['file']['type'], array("image/gif", "image/jpeg", "image/png", "image/jpg")) !== FALSE) {
$resize = new resizeImage();
// upload image in three dimesions
//$largePath = "uploads/news/large/";
//$largeImage = $resize->do_resize(500,400 ,$_FILES['file'],$largePath,0,"large");
$smallPath = "./images/product_gallary/";
// print_r($_FILES['file']);
// echo $_FILES['file']['name'];
$smallImage = $resize->do_resize(800, 500, $_FILES['file'], $smallPath, 0, "thumb", 90);
unlink($smallPath.$_POST['filename']);
//mysqli_query($connection,"INSERT INTO `photo_gallery` (filename, datetime) VALUES "
// . "('" . $smallImage . "','" . date('Y-m-d H:i:s') . "')");
//setMessage('Image successfully uploaded.', 'alert-msg success');
//redirect('product_page.php');
// echo "image successfully uploaded";
$result = " UPDATE `product_kit` SET `pcode`='" . $_POST['product_code'] . "',`pname`='" . $_POST['product_name'] . "',
`mrp`='" . $_POST['mrp'] . "',`pv`='" . $_POST['product_pv'] . "',`pcost`='" . $_POST['product_cost'] . "',`quantity`='" . $_POST['quantity'] . "',
`datetime`='" . date('Y-m-d H:i:s') . "',`description`='" . $_POST['description'] . "',`filename`='" . $smallImage . "',
`is_active`='" . $_POST['is_active'] . "',`real_filename`='" . $_FILES['file']['name'] . "' WHERE `pid`='" . $_POST['pid'] . "'";
} else {
$result = " UPDATE `product_kit` SET `pcode`='" . $_POST['product_code'] . "',`pname`='" . $_POST['product_name'] . "',
`mrp`='" . $_POST['mrp'] . "',`pv`='" . $_POST['product_pv'] . "',`pcost`='" . $_POST['product_cost'] . "',`quantity`='" . $_POST['quantity'] . "',
`datetime`='" . date('Y-m-d H:i:s') . "',`description`='" . $_POST['description'] . "',
`is_active`='" . $_POST['is_active'] . "' WHERE `pid`='" . $_POST['pid'] . "'";
}
mysqli_query($connection,$result);
setMessage('Product updated sucessfully.', 'alert-success');
}
redirect('product_page.php');
?>