function filter($twig,$filterName,$filter){
$items = mysql_query("SELECT * FROM `items` WHERE {$filterName} = '{$filter}'");
while ($row = mysql_fetch_array($items)){
$list[] = $row;
};
echo $twig->render('list.html', array('items' => $list));
}
if(!mysql_fetch_array($items)){
echo $twig->render('404.html');
exit;
}
function filter($twig,$filterName,$filter){
$items = mysql_query("SELECT * FROM `items` WHERE {$filterName} = '{$filter}'");
$list = []; // создаем пустой
while ($row = mysql_fetch_array($items)){
$list[] = $row;
};
if (!empty($list)) {
echo $twig->render('list.html', ['items' => $list]);
} else {
echo "ААААа-а-а-а-а!!!!!11 Все пропало!";
}
}