我正在处理一个简单的收件箱/ pm系统,我无法弄清楚为什么但是我可以让显示器用于发送消息,我可以显示已发送项目的列表,从收件箱中查看pms,但不是确定我做错了什么,任何提示赞赏..
这是我的代码:
<table>
<?php
$id = $_GET['id'];
$from_user = $_SESSION['user_id'];
$sql = "SELECT users.user_id, users.username, users.profile, messages.id, messages.to_user, messages.from_user,
messages.subject, messages.message, messages.has_read, messages.deleted, messages.date_sent
FROM `messages`
JOIN `users` ON messages.to_user = users.user_id
WHERE messages.from_user = '$from_user' AND messages.id = '$id' ORDER BY messages.date_sent DESC";
$result = mysql_query($sql);
$rows = mysql_fetch_array($result);
$from_user = $rows['from_user'];
$subject = $rows['subject'];
?><tr>
<td width="50px" align="center">
<img src="<?php echo $rows['profile']; ?>" width="40px"><br><?php echo $rows['username']; ?>
</td>
<td valign="top" width="350px">
<b><?php echo $rows['subject']; ?></b><br>
<?php echo $rows['message']; ?>
</td><td><?php echo $rows['date_sent']; ?></td>
</tr>
<tr>
<td colspan="3"><hr></td>
</tr>
</table>
答案 0 :(得分:1)
你指定了$ from_user两次,尝试删除第二个,看看你怎么做。