It is necessary to group all the dates in the database when outputting using GROUP BY wrote a function that gives the error Fatal error: Call to a member function fetch() on a non-object I can not understand what it is
// Соединение с БД $db = Db::getConnection(); $result = $db->query("SELECT id_shop, day FROM product_order GROUP BY day"); $i = 0; $dayList = array(); while ($row = $result->fetch()) { $dayList[$i]['id_shop'] = $row['id_shop']; $dayList[$i]['day'] = $row['day']; $i++; } return $dayList;
fetchAllmethod and there is no need to write a loop. - teran