コード例 #1
0
        function delete_new_arrival($post_new_arrival, $post_id)
        {
            $sql = "UPDATE tbl_product_type SET `type_new_arrival` = ? WHERE `type_id` = ?";
            $stmt = $this->conn->prepare($sql);
            if ($stmt === false) {
                trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
            } else {
                $stmt->bind_param("ss", $post_new_arrival, $post_id);
                $stmt->execute();
            }
            $stmt->close();
        }
        function delete_new_arrivals($new_type_id)
        {
            $sql = "DELETE FROM tbl_curated_2 WHERE `cur2_type_id` = ?";
            $stmt = $this->conn->prepare($sql);
            if ($stmt === false) {
                trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
            } else {
                $stmt->bind_param("s", $new_type_id);
                $stmt->execute();
            }
            $stmt->close();
        }
    }
    $_ajax = new AJAX();
    $item_id = filter_var($_POST['item_id'], FILTER_SANITIZE_NUMBER_INT);
    $product = $_ajax->get_type_id($item_id);
    //$_ajax->delete_new_arrival(0, $product->type_id);
    $_ajax->delete_new_arrivals($product->type_id);
}