var table = "users";
var id = 25;
$("#btndel").click(function() {
if (confirm("Are you sure ?")) {
$.ajax({
url: 'ajaxdel.php',
type: 'post',
data: {
'table': 'table',
'id': 'id'
},
success: function() {
location.href = "index.php";
}
})
}
});
ajaxdel.php
extract($_POST);
$stmt = $db->prepare('DELETE FROM '.$table. ' WHERE id = :id') ;
$stmt->execute(array(':id' => $id));
Table row is not deleted.