I have a file upload system where a user can upload an image/file with some text, and then it displays it.
I need help figuring out how to be able to delete a post by user command, so if the user posts an image with some text, the user can click a button next to the post and execute a command that deletes that post/image/text.
Here is my database display system:
<?php
$db = mysqli_connect("localhost", "boxofmem", "", "boxofmem_GMSConnect");
$sql = "SELECT * FROM images ORDER BY id ASC";
$result = mysqli_query($db, $sql);
while ($row = mysqli_fetch_array($result)) {
echo "<div id='img_div'>";
echo "<p style='font-family:Roboto;color:white;font-size:20px;'>".$row['text']."</p>";
echo "<img src='images/".$row['image']."' ' style='width:100%;height:100%;'>";
echo "</div>";
}
function deletePost() {
$db->query("DELETE from images WHERE id=0");
}
?>
DELETE FROM table_name WHERE condition;
DELETE FROM Customers
WHERE CustomerName='Alfreds Futterkiste';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.