111.php
<?php
/*
mysql*/
class mysql{
private $host;
private $name;
private $pass;
private $database;
private $bm; function __construct($host,$name,$pass,$database,$bm){
$this->host=$host;
$this->name=$name;
$this->pass=$pass;
$this->database=$database;
$this->bm=$bm;
$this->connect();
} function connect(){
$link=mysql_connect($this->host,$this->name,$this->pass) or die ($this->error());
mysql_select_db($this->database,$link) or die("没有该数据库:".$this->database);
mysql_query("SET NAMES '$this->bm'");
}
//------------------------------------------------------------------
//------------------------------------------------------------------
function error(){
return mysql_error();
}
function query($sql, $type = '') {
    if(!($query = mysql_query($sql))) $this->show('Say:', $sql);
    return $query;
}
function show($message = '', $sql = '') {
if(!$sql) echo $message;
else echo $message.'<br>'.$sql;
}
//------------
//------------------------------------------------------------------
//--------------insert-------
function fn_insert($table,$name,$value){
$this->query("insert into $table ($name) value ($value)");
}
//-----delete-------
function fn_delete($table,$idkey,$content){
if($this->query("delete from $table where $idkey='$content'")){
echo "删除成功";
}
}
//-----select-------
function fn_select($ziduan,$biao,$tiaoj){
$this->query("select $ziduan from $biao $tiaoj");
}
}
?>conn.php<?php
include("111.php");
$db =new mysql('localhost','root','root','hjw','gbk');
$select=$db->fn_select('*','shu','');
$row=mysql_fetch_array(mysql_query($select));
while($row){
?>
<table>
    <tr>
<td><?php echo $row['fenlei']?></td>
<td><?php echo $row['erji']?></td>
    </tr>
</table>
<?php } ?>
总是报错:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\WWW\shu----\conn.php on line 5