0
*IN CASE IT DISPLAYS "echo "error while deleting";" even the data has been deleted from the table. Please help me!
Page of functions:
 require 'conexao.php';
    function apagar($cod_pedido) {
        $link = conexao();
        $query = "delete from pedido_oracao where cod_pedido = '{$cod_pedido}'";
        mysqli_query($link, $query);
      } 
Page delete requests.php:
<?php
require 'funcoes.php';
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $cod_pedido = $_GET['cod_pedido'];
    if (apagar($cod_pedido)) {
        header('Location: index.html');
        exit;
    } else {
        echo "erro ao apagar";
    }
}
Where I’m pulling in html:
<?php foreach ($dados as $lista) { ?>
....
....
....
....
<div class="cell cell2" data-title="Excluir">
                                <a class="excluir" href="apagarPedidos.php?cod_pedido=<?= $lista['cod_pedido'] ?>"><i class="fas fa-trash-alt"></i></a>
                            </div>
    </div>
                    <?php } ?>
It worked out! THANK YOU!
– Vithor Carlos