-4
I tried everything, I don’t know why you’re making a mistake, PLEASE HELP ME THE MISTAKE IS: ( ! ) Notice: Undefined index: usuario_id in C: wamp64 www full table excluirAdminUserDoador.php on line 2
HTML CODE:
<?php
session_start();
include('../verifica_login.php');
$nome = $_SESSION['nome'];
$connect = mysqli_connect("localhost", "root", "", "login");
$query ="SELECT * FROM usuariodoador ORDER BY usuario_id DESC";
$result = mysqli_query($connect, $query);
?>
<!DOCTYPE html>
<html>
<head>
<title>Donatário</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />-->
</head>
<body>
<br /><br />
<div class="container">
<h3 align="center">Logins de donatarios</h3><h4>Olá, <?php echo $nome;?>, <a href="tabelaTesteAdmin.php">Ir para doadores</a></h4><a href="menuAdmin.php">voltar</a></h4>
<br /> <br>
<div class="table-responsive">
<table id="employee_data" class="table table-striped table-bordered">
<thead>
<tr>
<div class="cell">
<td>RA</td>
</div>
<div class="cell">
<td>Nome</td>
</div>
<div class="cell">
<td>Senha criptografada</td>
</div>
<div class="cell">
<td>Data da criação</td>
</div>
<div class="cell">
<td>Excluir</td>
<div class="cell">
<td hidden>Editar</td>
</div>
</tr>
</thead>
<?php
while($row = mysqli_fetch_array($result)){
echo '
<div class="row">
<tr>
<div class="cell" data-title="Age">
<td >'.$row["usuario_id"].'</td>
</div>
<div class="cell" data-title="Full Name">
<td>'.$row["usuario"].'</td>
</div>
<div class="cell" data-title="Full Name">
<td>'.$row["nome"].'</td>
</div>
<div class="cell" data-title="Job Title">
<td>'.$row["senha"].'</td>
</div>
<div class="cell" data-title="Location">
<td>'.$row["data_cadastro"].'</td>
</div>
<div class="cell" data-title="Location">
<td>
<a href="excluirAdminUserDoador.php?usuario_id='.$row['usuario_id'].'">Excluir
</a>
</td>
</div>
</tr>
';
}
?>
</table>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
$('#employee_data').DataTable();
});
</script>
<script>
$(document).ready(function(){
$('#minhaTabela').DataTable({
"language": {
"lengthMenu": "Mostrando _MENU_ registros por página",
"zeroRecords": "Nada encontrado",
"info": "Mostrando página _PAGE_ de _PAGES_",
"infoEmpty": "Nenhum registro disponível",
"infoFiltered": "(filtrado de _MAX_ registros no total)"
}
});
});
</script>
PHP CODE:
<?php
$usuario_id = $_GET['usuario_id'];
/*$usuario_id = isset($_POST['usuario_id']) ? $_POST['usuario_id'] : '';*/
include("../conexaoExcluirUser.php");
$sql = "DELETE FROM usuariodoador WHERE usuario_id = $usuario_id";
mysqli_query($link, $sql) or die ("Não foi excluido");
echo "<script language='javascript' type='text/javascript'>alert('Excluido com sucesso!');window.location.href='tabelaTesteAdmin.php'</script>";
?>
RELATED CODE:
<?php
$servidor = "localhost";
$usuario = "root";
$senha = "";
$banco = "login";
$link = mysqli_connect($servidor, $usuario, $senha, $banco);
?>
$_GET['usuario_id']
is not defined. Should be?– Woss