目前我是这"/> 目前我是这">

Home  >  Article  >  Backend Development  >  php-聊天页面自动输出数据库记录,ajax怎么来用

php-聊天页面自动输出数据库记录,ajax怎么来用

WBOY
WBOYOriginal
2016-06-02 11:32:47920browse

php

假如我的页面是这样,很简单


require_once '../config.php';
require_once '../class/DB.class.php';
$db = new DB(HOST, UNAME, UPWD, DBNAME, "utf-8");
/*********************取出数据库的前40条记录 **************************/
$sql = "select * from sendmes order by _second desc limit 0,40";
$result = $db->fetchAll($sql);
foreach ($result as $val){
echo $val["_name"].$val["_mood"]."对".$val["_target"]."说道:
".$val["_content"].""."
";
}
?>

目前我是这样来刷新的:

怎么用ajax实现页面不刷新页面,显示最近记录

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn