使用Ajax POST请求删除状态发布

时间:2015-03-20 13:32:39

标签: php jquery ajax

如何删除数据库中的单个记录?我尝试使用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>';

1 个答案:

答案 0 :(得分:0)

从Name_of_your_table删除 WHERE Columname = your_value;

请参阅w3schools delete query

PS。你的delete.php中有什么?

相关问题