读取类的代码:
<!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>

解决方案 »

  1.   

    错误代码: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\class2\db.php on line 32查询失败:
    select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5<br/>
    <br/>
      

  2.   

    没有连接数据库
    new db()后面应该先调用
    $db->connect($db_config);
      

  3.   

    你的SQL直接拿去MYSQL那里测试一下看有没有问题,估计你的SQL语句错误.
      

  4.   

    试试这样
    select * from hxci_news where pageclassid=0 order by news_addtime desc
      

  5.   

    $db = new db($db_config); 
      

  6.   

    select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5检查是不是少了空格???连一起了
      

  7.   

    大哥们那    PHP  文件没有问题 我的类文件没有是上传
    主要是JS文件   在传送数值进入PHP的时候不知道接收到没有
    同时也没有返回值谁明白 看下吧
      

  8.   

       $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(); 
    $db->connect($db_config);
    $sql="select * from hxci_news where pageclassid=0 order by news_addtime desc limit0,5"; 
    $db->query($sql);