我目前正在开发一个私人消息系统,因为系统目前能够发送和检索消息但我在检索消息回复时遇到问题。我正在尝试开发一个youtube类型的收件箱/评论系统。我有3个表fk相关,MESSAGES(id,sid,rid,subject,message,senttime)sid是用户loged的id,rid是接收者用户的id,即profile_id .... M_REPLY(id,mid,uid,reply ,senttime)mid是消息id的外键,uid是已发送回复的用户的id,回复是实际的消息... 下面是我执行消息检索的PHP代码
// Initialize the variables
$mail ="";
// Get list of Private Messages
$sql = "SELECT users.*, messages.*
FROM users, messages
WHERE messages.rid= '$log_id'
AND users.id = messages.sid
AND rdelete = '0'
ORDER BY senttime DESC" or die(mysqli_error);
$query = mysqli_query($conx, $sql);
$numrows = mysqli_num_rows($query);
// Gather data about the Pm's
if ($numrows > 0){
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$id = $row['id'];
$avatar = $row['avatar'];
$subject = $row['subject'];
$uname = $row['username'];
$message = $row['message'];
$senttime = $row['senttime'];
$pro_pic = '<img src="user/'.$uname.'/'.$avatar.'" alt="'.$uname.'" align="left" width="50" height="50" style="border:#E5E5E5 thin solid; padding:2px;">';
$mail .= '<div><a href="user_account.php?u='.$uname.'">'.$pro_pic.' '.$uname.'</a> | '.$subject.'</a></span> <div> '.$senttime.' <br /> '.$message.'<div>Replies here....</div></div></div>';
}
} else {
$mail = 'No messages';
}
然后我在我的html中回显$ mail来显示.... 加上我想知道如何显示回复文本框,而不是在循环中反复显示...请帮助