刚接触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;
}
?>