<?php
    error_reporting(E_ALL);
    ini_set('display_errors', 1);

    if (isset($_POST['key'])&&($_POST['key'] === 'pricepassword')&&isset($_POST['id'])&&$_POST['id']!="") {
        require('../connect.php');

        $conn = new mysqli($host, $user, $pass, $database);

        $sql = "DELETE FROM `billings` WHERE `id` = '{$_POST['id']}'";
        mysqli_query($conn, $sql);

        mysqli_close($conn);

        $response = array('success' => 'yes');
    } else {
        $response = array('success' => 'no', 'message' => 'Błąd autoryzacji i/lub błędne dane');
    }

    header('Content-Type: application/json');
    echo json_encode($response);
?>