Projecte M07, botiga en php.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1.1 KiB

<?php
include_once('parameters.php');
$product_id = $_GET['product_id'];
//========================================================================================================================================================
// Guardem les dades de lusuari a la bdd
if (true) {
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");
function checkOwner() {
session_start();
$_SESSION['userid'];
}
?>