File manager - Edit - /home/custbahd/irungikitchen.com/admin1/edit/index.php
Back
<?php session_start(); include_once('../db/connection.php'); include_once "../db/config.php"; if(isset($_POST['submit'])){ //POST Details $id = $_POST['id']; $name = $_POST['name']; $cat = $_POST['cat']; $label_1 = $_POST['label_1']; $price_1 = $_POST['price_1']; $label_2 = $_POST['label_2']; $price_2 = $_POST['price_2']; $label_3 = $_POST['label_3']; $price_3 = $_POST['price_3']; $p_range1 = $_POST['p_range1']; $p_range2 = $_POST['p_range2']; $ingredients = $_POST['ingredients']; $recipe = $_POST['recipe']; if ($_FILES['image']['name']=='') { $image = $_POST['image']; } else { $image = $_FILES['image']['name']; $target = "../images/".basename($_FILES['image']['name']); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)); } //If no update $sql = mysqli_query($conn, "SELECT * FROM shop WHERE id = '$id'"); if(mysqli_num_rows($sql) > 0){ $row = mysqli_fetch_assoc($sql); } if ($name == $row['name'] & $cat == $row['cat'] & $image == $row['image'] & $label_1 == $row['label_1'] & $price_1 == $row['price_1'] & $label_2 == $row['label_2'] & $price_2 == $row['price_2'] & $label_3 == $row['label_3'] & $price_3 == $row['price_3'] & $p_range1 == $row['p_range1'] & $p_range2 == $row['p_range2'] & $ingredients == $row['ingredients'] & $recipe == $row['recipe']) { $_SESSION['success'] = 'No change detected!'; } else { $sql = "UPDATE shop SET name='$name', cat='$cat', image='$image', label_1='$label_1', price_1='$price_1', label_2='$label_2', price_2='$price_2', label_3='$label_3', price_3='$price_3', p_range1='$p_range1', p_range2='$p_range2', ingredients='$ingredients', recipe='$recipe' WHERE id = '$id'"; //use for MySQLi OOP if($conn->query($sql)){ $_SESSION['success'] = 'Item updated successfully'; } else{ $_SESSION['error'] = 'Something went wrong in updating item'; } } } header('location: ../'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 1.59 |
proxy
|
phpinfo
|
Settings