host = $host; $this->user = $user; $this->passwd = $password; $this->database = $database; $this->conn=mysql_connect($this->host, $this->user,$this->passwd) or die(could not connect to $this->host); mysql_select_db($this->database,$this->conn) or die(could not switch to database $this->database); } //该函数用来关闭数据库连接 function close() { mysql_close($this->conn); } //该函数实现数据库查询操作 function query($querystr) { $res =mysql_query($querystr, $this->conn) or die(could not query database); return $res; } //该函数返回记录集 function getrows($res) { $rowno = 0; $rowno = mysql_num_rows($res); if($rowno>0) { for($row=0;$rowgetfieldsnum($res); if($fno>0) { for($i=0;$iquery($sql);//查询$rs = $sqldb->getrows($result);//获得记录集$num = $sqldb->getrowsnum($result);//获得记录数...剩下的操作就是循环取值,for($i=0;$iclose();当然这句可以不要,php会自动注销!但是这样能够养成一个好的习惯,最好还是加上!
...其他自己类推...不懂的可以提问!