I have a script in js to delete sql results with PHP and JS ...
LINK
<a href="javascript:;" onClick="deletar(<?php echo $exibe['matricula']; ?>);">
JS
function deletar(matricula) {
if (confirm("Tem certeza que deseja apagar?")) {
$.ajax({
type: "GET",
url: "index.php?pg=associados",
data: "&acao=deletar&matricula=" + matricula,
success: function() {
location.href = 'associados';
}
});
} else {
return false
}
}
PHP
if($_GET['acao'] == "deletar"){
$deletar = mysqli_query($conecta, "DELETE FROM socios WHERE matricula='".$_GET['matricula']."'");
}
What is happening is as follows, the column "enrolls" it is INT (5) so that the numbers are displayed in 5 numbers (00001). Until then the code works fine, however when I try to delete results above 00010 they do not delete.
Someone to help me?