These lines of code seem to work fine:
if(isset($_POST['result'])) {
if($_POST['result'] == 'true'){
$delete_post_query = mysqli_query($con, "UPDATE posts SET deleted='yes' WHERE id='$post_id'");
if($stmt = mysqli_prepare($con,$delete_post_query)){
}
}
}
However the prepared equivalent doesnt below doesnt seem to execute:
if(isset($_POST['result'])) {
if($_POST['result'] == 'true'){
$delete_post_query = mysqli_query($con, "UPDATE posts SET deleted='yes' WHERE id=?");
if($stmt = mysqli_prepare($con,$delete_post_query)){
mysqli_stmt_bind_param($stmt, "s",$post_id);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
}
}
}
I am quite confused by this and am fairly certain i am missing something obvious. Any suggestions/solution ?
UPDATE/EDIT:
I made a silly mistake copy/pasting the code so i updated that as suggested.
Have also tried the binding parameters as an integer and as a double respectively.
I believe the issue has something to do with binding parameters as when i replace the placeholder (i.e. '?') with the hardcoded variable $post_id, it works just fine.