Big fairy, old fairy, not big fairy, let's see why there is no data value after inheritance. Why don't I understand? This post was last edited by bixuewei at 23:25:10
$val){define($name,$val);}$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;$dbo = new PDO($dsn,DB_USER,DB_PASS);/*$sql="select * from task";$stmt =$dbo->prepare($sql);$stmt ->execute();$results = $stmt -> fetchALL(PDO::FETCH_ASSOC);print_r($results); $stmt ->closeCursor();*/class DB_Connect{public $db;protected function __construct($dbo=NULL){$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;try{$this->db =new PDO($dsn,DB_USER,DB_PASS);}catch(Exception $e){die($e->getMessage());}}}class Task extends DB_Connect{public function __construct($dbo=NULL,$useData=NULL){parent::__construct($dbo);}private function _LoadEventTask ($id=NULL){$sql="SELECT * FROM `task"`;try{$stmt = $this->db->prepare($sql);$stmt ->execute();$results = $stmt -> fetchALL(PDO::FETCH_ASSOC);$stmt ->closeCursor();return $results;}catch( Exception $e){die($e->getMessage() );}}}$ssss= new Task($dbo);var_dump ($ssss);
Reply to discussion (solution)
The gods are all asleep, and will suffer from insomnia again.
Object (Task) #2 (1 ){
["Db"] =>
Object (PDO) #3 (0 ){
}
}
Really hardworking old God.