مشکل با کلاس

Goback

Member
سلام،
من تازه میخوام پا بذارم تو دنیای شی گرایی،یه کلاس ساده نوشتم،خطا میده،حالمو گرفته اول کاری.
اینم کد:
PHP:
<?php
class newsShow{
    var $hostName='127.0.0.1';
    var $hostUserName='root';
    var $hostPassword='';
    var $DBName='mycms';
    var $DBLink;
    function __construct(){
        if($this->DBLink=mysql_connect($this->hostName,$this->hostUserName,$this->hostPassword) and mysql_select_db($this->DBName))
            return $this->DBLink;
            return false;
        }
    function __set($name,$val){
            $this->$name=$val;
        }
    function __get($name){
            return $this->$name;
        }
    function __destruct(){mysql_close($this->BDLink);}
    function addNews($title,$content){
            $sql="insert into news(title,content) values(\"$title\",\"$content\")";
            if(mysql_query($sql)){
            echo "ذخیره شد";
            return true;}
            echo "ذخیره نشد!!";
            return false;
        }
}
?>

خطاهاشم اینان:
Notice: Undefined property: newsShow::$BDLink in D:\wamp\www\MyCMS\inc\newsShow.class.php on line 17

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in D:\wamp\www\MyCMS\inc\newsShow.class.php on line 19
 

جدیدترین ارسال ها

بالا