在执行添加的时候出现
Notice: Undefined variable: sql in F:\phpNow\htdocs\blog\class\mySql_Class.php on line 63
是怎么回事,下面是代码:
//数据库连接config
<?php
define("HOSTNAME","localhost");
define("USERNAME","root");
define("USERPWD","123");
define("DBNAME","wg-8023.com");
define("WEBPATH",dirname(__FILE__));
?>
//连接数据库的类
<?php 
include_once("config_Class.inc.php");
class dbConn
{
    private $hostName="";
    private $hostUser="";
    private $hostPwd="";
    private $hostDb="";
    private $webPath="";
    public function __construct($hostName,$hostUser,$hostPwd,$hostDb,$webPath)
    {
        $this->hostName=$hostName;
        $this->hostUser=$hostUser;
        $this->hostPwd=$hostPwd;
        $this->hostDb=$hostDb;
        $this->webPath=$webPath;
    }
    public function exeSql($db,$mode,$flied_values="",$where="",$desc="",$limit="")
    {
        mysql_pconnect($this->hostName,$this->hostUser,$this->hostPwd);

        mysql_select_db($this->hostDb);


        mysql_query("SET NAMES UTF8");
        if($db=="insert")
        {
            foreach ($flied_values as $k=>$v)
            {
                $flied_array[]=$k;
                $value_array[]=$v;
            }
            $filed=implode(",",$filed_array);
$value=implode(",",$value_array);
$sql="insert into ".$db."({$filed})values({$value})";
        }
        if($mode=="update")
{
foreach($filed_values as $k=>$v)
{
$filed_array[]=$k."=".$v;
}
$sql="update ".$db." set ".implode(",",$filed_array)." where ".$where;
}
        if($mode=="delete")
$sql="delete from ".$db." where ".$where;
if($mode=="select")
{
if($flied_values=="")     
$flied_values="*";    $sql="select ".$flied_values." from ".$db;
if($where!="")        $sql.=" where ".$where;
if($desc!='')         $sql.=" ".$desc;
if($limit!='')        $sql.=" limit ".$limit;
}

//出问题:Notice: Undefined variable: sql in F:\phpNow\htdocs\blog\class\mySql_Class.php on line 63
$result["rs"]=mysql_query($sql);
$result["rows"]=mysql_affected_rows();
 //出问题:Notice: Undefined variable: sql in F:\phpNow\htdocs\blog\class\mySql_Class.php on line 67 if(mysql_error()!="")
{
$this->errProc(mysql_errno(),mysql_error(),$_SERVER['SCRIPT_NAME'],$sql);
}
mysql_close();
return $result;
    }    public function getAll($db,$mode,$filed_values='',$where='',$desc='',$limit='')
{
$result=$this->exeSql($db,$mode,$filed_values,$where,$desc,$limit);
while($array=mysql_fetch_array($result["rs"]))
{
$arr[]=$array;
}
return $arr;
}//出问题:Warning: error_log(F:\phpNow\htdocs\blog\class/error/2010-11-24 08:47:36.log) [function.error-log]: //failed to open stream: Invalid argument in F:\phpNow\htdocs\blog\class\mySql_Class.php on line 93 public function errProc($eNo,$eMsg,$eFile,$eSql)
{
$errorPath=$this->webPath;
if(!is_dir($errorPath."/error/"))   mkdir($errorPath."/error/");
$msg="★★★★★★★★★错误开始★★★★★★★★★"."\n";
$msg.="错误的编号:{$eNo}"."\n";
$msg.="错误的信息:{$eMsg}"."\n";
$msg.="错误的文件:{$eFile}"."\n";
$msg.="错误的SQL语句:{$eSql}"."\n";
$msg.="错误的时间:".date("Y-m-d H:i:s",time()+8*3600)."\n";
$msg.="★★★★★★★★★错误结束★★★★★★★★★"."\n";
error_log($msg,3,$errorPath."/error/".date("Y-m-d H:i:s").".log");
}
}
?>
//执行添加过程的处理页面
<?php
include_once("../class/config_Class.inc.php");
include_once("../class/mySql_Class.php");
$dbConn=new dbConn(HOSTNAME,USERNAME,USERPWD,DBNAME,WEBPATH);$class=$_GET["class"];
if($class=="add_Admin_User")
{
$admin_Name=$_POST["add_Admin_Name"];
$admin_Pwd=$_POST["add_Admin_Pwd"];
$admin_Pwd=$_POST["add_Admin_Repwd"];
$admin_Glqx=$_POST["add_Admin_Qxsz"];//值为0或1
$admin_LogIp=$_SERVER["REMOTE_ADDR"];
$admin_Time=date("Y-m-d H:i:s",time()+8*3600);

$dbConn->exeSql("wg_admin","insert",array("admin_Name"=>"'".$admin_Name."'","admin_Pwd"=>"'".$admin_Pwd."'","admin_Glqx"=>$admin_Glqx,"admin_LogIp"=>"'".$admin_LogIp."'","admin_Time"=>"'".$admin_Time."'"));
}
?>