false)))) { die('Не могу подключиться к БД'); } $db -> exec('SET CHARACTER SET utf8'); $selected = []; if ($_REQUEST['action']=='submit') { foreach($_REQUEST as $key=>$value) { if (strpos($key,'unit_')===0) { $group_id=intval(substr($key,5)); $unit_id=$value; setcookie('unit_'.$group_id,$unit_id,time()+86400*365*10); $selected[$group_id]=$unit_id; } } ?> WeatherMon (Настройки)

Сохранено...

$value) { if (strpos($key,'unit_')===0) { $group_id=intval(substr($key,5)); $unit_id=$value; setcookie('unit_'.$group_id,$unit_id); $selected[$group_id]=$unit_id; } } ?> WeatherMon (Настройки) prepare( 'select id,name,(select count(*) from units where unit_group=g.id) cnt from unit_groups g' ); $q -> execute(); echo '
'; while ($row = $q -> fetch(PDO::FETCH_ASSOC)) { $group_id = $row['id']; $group_name = $row['name']; $group_cnt = $row['cnt']; echo '

'.$group_name.'

'; $q_p = $db -> prepare( 'select id,name from units where unit_group='.$group_id ); $q_p->execute(); echo '
'; } echo ''; echo '

'; echo '
'; } ?>