应有那个数据库操作类的一个简单实例

<?php
 header("content-Type: text/html; charset=gb2312");
 include_once("DBHelper.php");
?> 
<!--==========业务逻辑==========-->
<?php
 $conn = new ADOConnection;
 $conn -> PConnect("localhost","root","weoffice","eoffice");//数据库连接
 $conn -> SetUnicode("set names gb2312");//**设置字符集***
 //比系统登录时间延迟6分钟
 $onlineNum = $conn -> ExecuteQuery("SELECT count(*) as nums
  FROM user_online
  WHERE VISIT_TIME >= date_sub( now( ) , INTERVAL 10
  MINUTE )");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
<meta http-equiv="content-type" content="text/html" charset="gb2312" />
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>

<body style="text-align:center; margin-top:150px;">
    <h3>当前在线人数:<span style="color:#ff0000;"><?php echo $onlineNum[0]["nums"]; ?></span></h3>
</body>
</html>
<?php
$conn -> ConnClose();
?>

你可能感兴趣的:(数据库)