读取类的代码:
<!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">
<?php require_once('db.php'); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<?php
$db_config["hostname"] = "127.0.0.1"; //服务器地址
$db_config["username"] = "root"; //数据库用户名
$db_config["password"] = "root"; //数据库密码
$db_config["database"] = "hxci"; //数据库名称
$db_config["charset"] = "gbk";
$db=new db();
$sql="select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5";
$db->row_query($sql);
?>
</body>
</html>
<!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">
<?php require_once('db.php'); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<?php
$db_config["hostname"] = "127.0.0.1"; //服务器地址
$db_config["username"] = "root"; //数据库用户名
$db_config["password"] = "root"; //数据库密码
$db_config["database"] = "hxci"; //数据库名称
$db_config["charset"] = "gbk";
$db=new db();
$sql="select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5";
$db->row_query($sql);
?>
</body>
</html>
select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5<br/>
<br/>
new db()后面应该先调用
$db->connect($db_config);
select * from hxci_news where pageclassid=0 order by news_addtime desc
主要是JS文件 在传送数值进入PHP的时候不知道接收到没有
同时也没有返回值谁明白 看下吧
$db_config["username"] = "root"; //数据库用户名
$db_config["password"] = "root"; //数据库密码
$db_config["database"] = "hxci"; //数据库名称
$db_config["charset"] = "gbk";
$db=new db();
$db->connect($db_config);
$sql="select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5";
$db->query($sql);