public static function getProductsList() {
$db = new PDO('mysql:host=;dbname=', '', '');
$productsList = array();
$result = $db->query('SELECT id, title, date, short_content FROM products ORDER BY date DESC LIMIT 10');
$i = 0;
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$productsList[$i]['id'] = $row['id'];
$productsList[$i]['title'] = $row['title'];
$productsList[$i]['date'] = $row['date'];
$productsList[$i]['short_content'] = $row['short_content'];
$i++;
}
return $productsList;
}
К БД данные убрал, вопрос в том почему выдает следующую ошибку
Uncaught Error: Call to a member function fetch() on boolean in