botiga_php/edit-product.php

37 lines
1.0 KiB
PHP

<?php
include_once('parameters.php');
$product_id = $_GET['product_id'];
//========================================================================================================================================================
// Guardem les dades de lusuari a la bdd
if (false) {
try {
$sql = $con->prepare("DELETE FROM bp_products WHERE bp_product_id = ?");
$sql->bind_param('i', $product_id);
$rs = $sql->execute();
if($rs) {
$response['success'] = true;
} else {
$response['success'] = false;
throw new Exception("Hi ha hagut un error al insertar el registre");
}
// if($rs) {
// echo ("El registre ha estat satisfactori");
// } else {
// echo ("Hi ha hagut un error al insertar el registre");
// }
} catch( Exception $e ) {
$response['message'] = $e->getMessage();
}
echo json_encode($response);
}
header("Location: ./my-products.php");
?>