1.尽量细心点,T_T.........
==================================
$dbinstall=new db;
$dbintall->_set();//手误!应该是$dbinstall->_set();2.加强面向对象的认识.
===============================================
看看:
http://mysheji.com/Article/pro/PHP/gaoji/19422.html
改改:
<?php
//因为你的参数是动态传入的,所以属性不能定为private(类的私有属性)
class db{
public $dblocation;
public $dbuser;
public $dbpass;
function _set(){
$this->dblocation= $_POST['dblocation'];
$this->dbuser = $_POST['dbuser'];
$this->dbpass = $_POST['dbpass'];
//$conn= mysql_connect($dblocation,$dbuser,$dbpass);//这里应该再封装一下.
//以下继续封装
//if($conn){
//echo "<script type='text/javascript'>alert('数据库连接成功!');</script>";
//}
//参考调用方式:
$this->_connect();
if($this->conn) $this->showError('数据库连接成功!');
}
function _connect()
{
 $this->conn = mysql_connect($this->dblocation,$this->dbuser,$this->dbpass)
}
function showError($param)
{
  echo "<script type='text/javascript'>alert('".$param."');</script>";
}
}