I have a problem preventing me from proceeding on my project. I fail to understand what is wrong until a certain row id cannot be deleted when the query is run.
My code, step by step:
(1) This is the button code, which once I click it emits a popup message to confirm delete, and once I confirm delete (OK), on browser it shows as if the row deleted (disappear) and when I refresh the page, data appears again which means it is not deleted.
<input type="button" onclick='return deletethis(this)' class="btn btn-
triangle btn-red" value="X">
(2) And the java code:
<script type="text/javascript">
function deletethis(el){
var e = $(el).parent().attr('id');
var cnf = confirm('Are you sure, you want to delete?');
if(cnf == true){
$(el).parent().parent().hide(1000);
$.post('deleteAdd.php', {id:e}, function(data){
});
}
}
</script>
(3) This is "deleteAdd.php" file which holds PHP code for deleting
<?php
global $database;
$uid = $_POST['id'];
$q = "DELETE FROM sale_daily WHERE id=$uid";
$r = $database->query($q);
$rw = $database->fetch_array($r);
?>