主题:  刚接触PHP,哪位侠客帮看下;

我有BLOG了

职务:普通成员
等级:4
金币:16.8
发贴:2209
#12006/8/18 12:21:49
刚接触PHP,实在看不懂,是数据库调用问题吗?

网站地址: www.lawchinahr.com/

每个动态调用的地方都提示错误:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /data/home/zn22p1/htdocs/inc/db.php on line 52

这句是什么意思?

db.php的文件为

<?
class db {
    var $Host="mysql.lawchinahr.com";
    var $User="zn22p1";
    var $Password="a8m3n4w9";
    var $DB="zn22p1_db";
    var $linkid;
    var $res;
    var $record;
    var $recordnum;
    var $error;

    function db() {
        $this->linkid = mysql_pconnect($this->Host, $this->User, $this->Password) or die('database connection failed');
        mysql_select_db($this->DB) or die('database connection failed');
    }
    /**
     * function connection to database
     *
     * if connection failed, halt immediately :-(
     */
    //function connect() {
    //    $linkid = @mysql_pconnect($this->Host, $this->User, $this->Password) or die('database connection failed');
    //    @mysql_select_db($this->DB) or die('database connection failed');
    //    return $linkid;
    //}

    /**
     * fucntion doing the query
     */
    function query($query) {
        $this->res = mysql_query($query, $this->linkid);
//return $res;
    }

    /**
     * function seeking the internal pointer to next record
     *
     * if success, true will be returned
     * else false
     */
    function record() {
        $this->record = mysql_fetch_array($this->res);
        //return $record;
    }


    /**
     * function returning row no of result
     */
    function num_rows() {
        $this->recordnum=mysql_num_rows($this->res);
    }

    
    
}
function getid(){
$date=date("YmdGis";
return $date;
}
function getic(){
$date=date("Y-m-d G:i:s";
return $date;
}

function getidd(){
$dated=date("Y-m-d";
return $dated;
}
function getip(){
$date=date("Y";
return $date;
}
?>



比特空间

职务:普通成员
等级:3
金币:10.0
发贴:853
#22006/8/24 16:36:42
function db() {
$this->linkid = mysql_pconnect($this->Host, $this->User, $this->Password) or die('database connection failed');
mysql_select_db($this->DB,$this->linkid) or die('database connection failed');
}



Mike

职务:版主
等级:6
金币:11.0
发贴:5148
#32006/9/11 14:37:38
请仙鹤同志认真db.php中的数据库连接