1
I created a system for post creation. But I am not able to delete in the bank but appears the confirmation of Deleted Successfully!
<?php
$db = mysqli_connect("127.0.0.1", "root", "", "photos");
$sql = "SELECT * FROM images";
$result = mysqli_query($db, $sql);
while ($row = mysqli_fetch_array($result)) {
echo "<div class='post-item'> <div class='inner'>";
echo " <div class='post-title'><h2><a href='#'> ".$row['titulo']."</a></h2></div>";
echo "<div class='post-image'><div></div><img src='images/".$row['image']."'></div ";
echo " <div class='post-meta-top'>Posted <span class='post-date'>2 days ago</span> </div>
<div class='clear'></div> ";
echo " <div class='post-desc'>
<p>".$row['texto']."</p>
</div>";
echo " <a href='?id=".$row['id']."&Acao=Deletar'><button>Deletar</button></a>
</div>
</div>";
}
if (isset($_GET['Acao']) && $_GET['Acao'] == 'Deletar') {
$id = $_GET['id'];
$sql = mysqli_query("DELETE FROM images WHERE id='$id' ");
if ($result) {
echo '<script type="text/javascript">alert("Comentario Excluido!"); </script>';
} else {
echo '<script type="text/javascript">alert("Erro!"); </script>';
}
}
?>
Only use the tag [tag:phpmyadmin] if the problem is with phpmyadmin itself, in your case the problem is with the script and/or mysql. Phpmyadmin is not a part application and does not influence your script, I recommend this reading: http://answall.com/q/115691/3635
– Guilherme Nascimento