示例#1
0
<?php

require_once 'template/header.php';
require_once 'functions/productsFunctions.php';
require_once 'functions/sessionFunctions.php';
$id = $_POST['id'];
deleteProducts($connection, $id);
$_SESSION['success'] = "Product was successfully removed!";
header("Location: retrieve.php");
die;
示例#2
0
                    } else {
                        echo getProducts();
                    }
                } else {
                    echo getProduct($pathParts[1]);
                }
                break;
                // Create product on database using POST and view it using GET Method
            // Create product on database using POST and view it using GET Method
            case 'POST':
                postProducts();
                break;
                // Delete requrested product from database using DELETE Method
            // Delete requrested product from database using DELETE Method
            case 'DELETE':
                if (empty($pathParts[1])) {
                    echo "you can delete everthing!!";
                } else {
                    deleteProducts($pathParts[1]);
                }
                break;
                // Allow the user to Edit/Update Products on Database
            // Allow the user to Edit/Update Products on Database
            case 'PATCH':
                if (isset($pathParts[1])) {
                    updateProducts($pathParts[1]);
                }
        }
        break;
        // End of Switch Statement
}