-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
61 lines (50 loc) · 1.69 KB
/
edit.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
$pid=$_GET['pid'];
include_once "../shared/connection.php";
$src_path=$_FILES['imname']['tmp_name'];
if(!empty($src_path)){
date_default_timezone_set("Asia/Kolkata");
$unique=date("YmdHis").".jpg";
$dest_path="../images/Products/$unique";
move_uploaded_file($src_path,$dest_path);
$status=mysqli_query($conn,"update products set impath='$dest_path' where pid=$pid");
if(!$status){
echo "There is some problem in updating your product";
die;
}
}
$cmp_name=$_POST['cmp_name'];
if(!empty($cmp_name)){
$status=mysqli_query($conn,"update products set cmp_name='$cmp_name' where pid=$pid");
if(!$status){
echo "There is some problem in updating your product";
die;
}
}
$name=$_POST['name'];
if(!empty($name)){
$status=mysqli_query($conn,"update products set name='$name' where pid=$pid");
if(!$status){
echo "There is some problem in updating your product";
die;
}
}
$details=$_POST['details'];
if(!empty($details)){
$status=mysqli_query($conn,"update products set details='$details' where pid=$pid");
if(!$status){
echo "There is some problem in updating your product";
die;
}
}
$price=$_POST['price'];
if(!empty($price)){
$status=mysqli_query($conn,"update products set price=$price where pid=$pid");
if(!$status){
echo "There is some problem in updating your product";
die;
}
}
echo "<center><h2 style='margin-top:40px;'>Your Product has been Updated Successfully !</h2>
<a href='view.php'>Click here to go back to the main page!</a><center>"
?>