Есть такой кусок кода:
class tapinambur {
protected $mysqli = false;
protected $db_name = '';
function __construct($db_name) {
$this->db_name = $db_name;
}
public function connectDB () {
$this->mysqli = new mysqli('localhost', '***', '***', $this->db_name);
$this->mysqli->query("SET NAMES 'utf8'");
}
public function closeDB () {
$this->mysqli->close();
}
function getNews() {
connectDB();
$result = $this->mysqli->query("SELECT * FROM `news` ORDER BY `id` DESC");
closeDB();
return resultToArray($result);
}
При обращении к getNews()
пишет:
Call to undefined function connectDB()
Помогите пожалуйста, только начал изучать ООП на PHP.
Версия PHP: 7