Hello I have this query…
if (isset($_REQUEST['deletePost'])) {
$q = $dbc -> prepare("DELETE FROM boardposts WHERE postID = ? AND parentID = ?");
$q -> execute(array($_REQUEST['deletePost'], $_REQUEST['deletePost']));
}
The request I make from my js is called deletePost and the id which is carried along with it is correct.
Why might this fail like it is doing?
My js looks like so
$('.deletePost').click(function() {
var id = $(this).attr('id');
$.ajax({
data: {
deletePost: id
},
success: function() {
$('.content').empty().html('<p>The selected post and all of its children have been deleted.</p>');
}
});
return false;
});
It returns the success call and all other ajax on my site works fine. The settings for ajax are defined elsewhere.
Because your query looks wrong. Shouldn’t that be
WHERE postID = ? OR parentID = ??