展开全部
shouye.php?php
include"conn.php";
$sql="select * from rooms order by id";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){?>
"><?php echo $row["name"];?>
messages.php<?php
$room_id=$_GET["id"];
include"conn.php";
echo "
";
if(isset($_POST["sub"])){
$hid=$_POST["hid"];
$content=$_POST["content"];
$sql="insert into messages(room_id,content,sent_at_datetime) values('".$hid."','".$content."','".time()."')";
$query=mysql_query($sql);
$sql_rooms="select * from rooms where id!='".$hid."'";
$query=mysql_query($sql_rooms);
while($row=mysql_fetch_array($query)){
?>
"><?php echo $row["name"];?>
}
}
$sql_mess="select * from messages where room_id='".$room_id."'";
$query=mysql_query($sql_mess);
while($row=mysql_fetch_array($query)){?>
$date=$row["sent_at_datetime"];
echo $row["content"]?> <?php echo date("Y-m-d H:i:s",$date+8*60*60);echo "
";?>
">
时间好像是不对,水平拙劣,希望能帮到你,共同进步!!e68a84e8a2ad3231313335323631343130323136353331333337373539!