如何删除数据库中的单个记录?我尝试过Ajax,但没有成功。这是我的代码,每行都有一个唯一的数字ID,所以我需要它来删除它,但我不知道如何获得它。
echo '<tr>';
echo '<td>';
echo '<a href="korisnik.php?id='.$session_poster_id.'">';
echo '<div class="profile_pic_div" style="margin-top:10px;">';
echo "<img src='$avatar' style='width:40px;height:40px;'>";
echo '</div>';
echo '</a>';
echo '<div class="timestamp" style="margin-left:50px;margin-top:-43px;font-size:15px;">';
echo $user['vrijeme'];
echo '</div>';
echo '<a href="delete.php?post_id='.$post_id.'">';
echo '<div class="icon-x" style="margin-left:550px;margin-top:-15px;">';
echo '</div>';
echo '</a>';
echo '<div class="post_div" style="margin-top:30px;">';
if (strlen($user['post']) > 500) {
$user['post'] = substr($user['post'], 0, 500);
$user['post'] = substr($user['post'], 0, strrpos($user['post'], ' ')).'... <a href="story.php?post_id='.$post_id.'">Read More</a>';}
echo $user['post'];
echo '</div>';
echo '<br>';
echo '<a href="story.php?id='.$post_id.'">Komentiraj</a>';
echo '</td>';
echo '</tr>';
从Name_of_your_table删除WHERE Columname=your_value
请参阅w3schools删除查询
PS。delete.php中有什么?