первый скрипт:
<?php
class C_GetDB {
public $db;
function __construct() {
$this->db = new E_SafeMySQL();
}
public function getDataLittleSms($city) {
$data = '';
$KEY = $this->db->getAll("SELECT * FROM `_settings` WHERE `city` = ?s LIMIT 1",$city);
if (!empty($KEY)) {
foreach ($KEY as $key_db => $row) {
$apikey = $row['littlesms'];
$loginsms = $row['loginlittlesms'];
}
$data = array("API_KEY" => $apikey, "LOGIN" => $loginsms);
}
return $data;
}
}
?>
второй скрипт:
<?php
class C_LittleSms extends C_GetDB {
private $init = array();
function __construct(){
$this->init = parent::getDataLittleSms($_SESSION['city_en']);
var_dump($this->init);
}
}
?>
вызываю так
new C_GetDB();
new C_LittleSms();
поидее должен вывести ключи, но выводит ошибку
Fatal error: Call to a member function getAll() on a non-object in ../classes/controller/C_GetDB.php on line 12
собственно при вызове из LittleSms объект хранящийся в $this->db в первом скрипте становится NULL, почему?