I created a similar question but has too confused, hope to get some help now giving this shortcode. I've tried to change all this code from another answer here at StackOverflow. I have able to make the button works but It just removed posts, not from user_id.
Trying to create a button to remove the post.
Select:
$sth = $db->prepare("
SELECT
*
FROM
users, profile_post
WHERE
profile_post.user_id = users.user_id AND
users.user_id = :id
ORDER BY `profile_post`.`dateupload` DESC
");
Form:
echo '<form name="delete" action="" method="post"><button><i class="fa fa-trash"><input type="hidden" name="name" value="' . $row["post"] .'"></i></button></form>';
PHP:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if(isset($_POST['delete'])){
$postid1 = $row["post"];
$stmt = $db->prepare("DELETE FROM `profile_post` WHERE `profile_post`.`post` = $postid1 ");
echo("Sucess.");
}
}
?>