📄 chat_display.php.bak
字号:
<!--显示留言界面:chat_display.php------------------->
<html>
<head>
<title>显示用户留言</title>
<meta http-equiv="refresh" content="500;url=chat_display.php">
</head>
<body>
<?php
require_once("sys_conf.inc");
//连接数据库
$link_id=mysql_connect($DBHOST,$DBUSER);
mysql_select_db($DBNAME);
$str="select * from chat ORDER BY create_time;";//按时间查找所有聊天信息
$result=mysql_query($str);
$rows=mysql_num_rows($result);//取得查询结果的记录笔数
//取得最后15笔聊天记录,并显示
@mysql_data_seek($result,$rows-15);//移动记录指针到前15笔
if($rows<15)
$l=$rows; //如果总记录小于15
else $l=15;
for($i=1;$i<=$l;$i++)
{
list($id,$author,$create_time,$text)=mysql_fetch_row($result);
echo $create_time; echo " "; echo"【".$author."】"; echo"说到: ";
echo $text; echo"<br>";
}
//清楚库中过时的数据
@mysql_data_seek($result,$rows-20);//指针移动到前20笔记录
list($limtime)=mysql_fetch_row($result);
$str="delete from chat where create_time<'$limtime';";
$result=mysql_query($str);
//关闭数据库
mysql_close($link_id);
?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -