我刚刚创建了一个消息系统,但我想显示正在查看的消息旁边的收件箱,就像facebook消息系统那样,但我可以让它在彼此旁边工作我必须通过链接这样做收件箱在index.php上查看并查看你必须去的信息index.php?hash = VAULE如何让他们像facebook一样让他们并肩工作
<?php
if(isset($_GET['hash']) && !empty($_GET['hash'])){
$hash = $_GET['hash'];
$message_query= mysql_query("SELECT from_id, message FROM messages WHERE group_hash='$hash'");
while($run_message = mysql_fetch_array($message_query)){
$from_id = $run_message['from_id'];
$message = $run_message['message'];
$staff_query = mysql_query("SELECT staff_username FROM staff_users WHERE id='$from_id'");
$run_staff = mysql_fetch_array($staff_query);
$from_staff = $run_staff['staff_username'];
echo "<p><b>$from_staff</b><br/>$message</p>";
}
?>
<br/>
<form method='POST'>
<?php
if(isset($_POST['message']) && !empty($_POST['message'])){
$new_message = $_POST['message'];
mysql_query("INSERT INTO messages VALUES('','$hash','$my_id','$new_message')");
header('location: index.php?hash='.$hash);
}
?>
<div class="message_box">
Enter Message : <br/>
<textarea name='message' placeholder="Write a reply" rows='6' cols="60"></textarea>
<br/>
<input type='submit' name="smb" value="Reply"/>
</form>
</div>
<?php
}else{
$get_con = mysql_query("SELECT hash, staff_one, staff_two FROM messages_hash WHERE staff_one='$my_id' OR staff_two='$my_id'");
while($run_con = mysql_fetch_array($get_con)){
$hash = $run_con['hash'];
$staff_one = $run_con['staff_one'];
$staff_two = $run_con['staff_two'];
if($staff_one == $my_id){
$select_id = $staff_two;
}else{
$select_id = $staff_one;
}
$staff_get = mysql_query("SELECT staff_username FROM staff_users WHERE id='$select_id'");
$run_staff = mysql_fetch_array($staff_get);
$select_staff = $run_staff['staff_username'];
echo "<p><a href='index.php?hash=$hash'>$select_staff</a></p>";
}
}
?>
答案 0 :(得分:0)
创建两个文件。一个拉动收件箱,一个拉动当前信息。
然后将它们单独包含在您希望它们出现的代码中。