$count = $db->prepare(" select * from (select count(id) from img where `mod` = '0' and block = '0' and category = :id and time = :time) as count1, (select count(id) from img where `mod` = '0' and block = '0' and category = :id) as count2 "); $count = $count->execute(array( ':id' => $post['id'], ':time' => time()-86400 )); $count = $count->fetch(PDO::FETCH_OBJ); # первый echo $count->count1; # второй echo $count->count2;