3
Good morning, I’m trying to delete the items from a list but without success. Listing.php
<html>
<head>
    <link rel="stylesheet" href="/assets/_css/menu.css"/>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="script.js"></script>
</head>
<body>
<?php
$conecta = mysqli_connect('localhost', 'root', '') or trigger_error(mysql_error());
// Tenta se conectar a um banco de dados MySQL
mysqli_select_db($conecta, 'car0000001') or trigger_error(mysqli_error());
mysqli_set_charset($conecta, 'utf8');
echo '<tbody>';
$sql = mysqli_query($conecta,'SELECT * FROM usuario');
while ($row = mysqli_fetch_assoc($sql)) {
    echo '<table>';
    echo '<thead>';
    echo '<th>Código</th>';
    echo '<th>Nome</th>';
    echo '<th>Endereço</th>';
    echo '<th>E-mail</th>';
    echo '<th>Telefone</th>';
    echo '<th>Celular</th>';
    echo '<th>Cadastro</th>';
    echo '<th>Editar</th>';
    echo '<th>Excluir</th>';
    echo '</thead>';
    echo '<tr>';
    echo '<td>' . $row['id_usr'] . '</td>';
    echo '<td>' . $row['nome_usuario_usr'] . '</td>';
    echo '<td>' . $row['endereco_usuario_usr'] . '</td>';
    echo '<td>' . $row['email_usuario_usr'] . '</td>';
    echo '<td>' . $row['fone_usuario_usr'] . '</td>';
    echo '<td>' . $row['cel_usuario_usr'] . '</td>';
    echo '<td><a href="cadastro-completo.php"><img src="assets/imgs/edit.png" width="20px"></a></td>';
    echo '<td><img src="assets/imgs/edit.png" width="20px"></td>';
    echo '<td><button type="submit" action="deleta-cadastro.php" value="">Deleta</button>';
    echo '<br>';
    echo '</tr>';
    echo '</table>';
}
?>
</body>
</html>
delete-register.php
<?php
conecta = mysqli_connect('localhost', 'root', '') or trigger_error(mysql_error());
// Tenta se conectar a um banco de dados MySQL
mysqli_select_db($conecta, 'car0000001') or trigger_error(mysqli_error());
mysqli_set_charset($conecta, 'utf8');
$id = $_GET['deleta'];
$deleta = mysqli_query($conecta,'DELETE FROM `usuario` WHERE `id_usr` =$usuario';
if($deleta == ''){
    echo "<script>alert('Houve um erro ao deletar!');
</script>";
}else{
    echo "<script>alert('Registro excluido com sucesso!');
</script>"; 
    ?>
"unsuccessful", What does that mean? Makes a mistake? What happens? That’s too vague
– Ricardo Pontual
means I can’t make it work. There’s no mistake, and it doesn’t delete anything in the BD.
– João Vitor
The construction of table tb is wrong. You are opening a
tbodybefore the table.– Sam
Unfortunately, it’s not working.
– João Vitor