-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.php
29 lines (27 loc) · 926 Bytes
/
update.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
<?php
$conn = mysqli_connect("localhost","admin","123456","sprinkles");
if (mysqli_connect_error())
{
echo "Can't connect to database" ;
die();
}
else
{
if(isset($_POST['updatedata'])) {
$id=$_POST["id"];
$name = $_POST["product"];
$price = $_POST["price"];
$category = $_POST['gridRadios'];
$des = $_POST['description'];
$qty = $_POST['Quantity'];
$img=$_POST['image'];
$qry = "Update product set `img`='$img',`name`='$name', `price` ='$price' ,`description` = '$des',`category`= '$category',`quantity`='$qty' where `id`='$id' ";
$res = $conn->query($qry);
if ($res) {
echo '<script> alert("Data saved");</script>';
header('location:admin0.php');
} else
echo '<script> alert("Data not saved");</script>';
}
}
?>