我正在做一个小型的社交网络项目。到目前为止,我有一个一切正常的消息系统,用户可以发送和接收消息。我正在寻找一种让用户删除自己的消息的方法。
已将“删除”行设置为通过回显命令在每条消息的侧面显示。有没有办法让这个文本可点击,这样当用户点击它时,它会将数据库中的值从“0”更改为“1”?
代码:
<?php
$page_title = "Messages";
include('includes/header.php');
confirm_logged_in();
include('includes/mod_login/login_form.php');
?>
<div class="modtitle">
<div class="modtitle-text">Inbox</div>
</div>
<div class="modcontent">
<strong>Inbox</strong> | <a href="messages_sent.php">Sent Messages</a>
| <a href="messages_deleted.php">Deleted</a> <br /><br />
<table
width="100%" border="0" cellpadding="5" cellspacing="0">
<tr
bgcolor="#CCCCCC">
<td width="30%"><strong>Recieved</strong></td>
<td width="20%"><strong>From</strong></td>
<td width="28%"><strong>Subject</strong></td>
<td width="0%"><strong>Read/Unread</strong></td>
<td width="0%"><strong>Delete</strong></td>
</tr>
<?php
$inbox_set = get_inbox();
while ($inbox =
mysql_fetch_array($inbox_set)) {
?>
<?php if ($inbox['read'] == 0) { ?> <tr bgcolor="#6666B3"> <?php }
if ($inbox['read'] == 1) { ?> <tr>
<?php } ?>
<td><?php
$datesent1 = $inbox['date_sent'];
echo "$datesent1"; ?></td>
<a href="profile.php?id={$inbox['from_user_id']}"><td><?php echo "<a
href=\"profile.php?id={$inbox['from_user_id']}\">{$inbox['display_name']}";
?></td></a>
<td><?php echo "<strong><a href=\"read_message.php?msg={$inbox[0]}\">{$inbox['subject']}</a></strong>";
?></td>
<td><?php if ($inbox['read'] == 0) {
echo "Unread";
}
if ($inbox['read'] == 1) {
echo "Read";
}
?></td>
<td>
<?php
if ($inbox['delete'] == 0) {
echo "Delete";
}
if ($inbox['delete'] == 1) {
echo "$deleted_set;";
}
; ?></td>
</td>
<?php }
?>
</tr> </table>
</div>
<?php include('includes/footer.php'); ?>