$post = $pdo->prepare('SELECT * FROM post ORDER BY id DESC LIMIT 2');
$post->execute();
$news = array();
while($base = $post->fetchAll(PDO::FETCH_BOTH)) {
$news[] = $base;
}
<?php foreach ($news as $n): ?>
<p><strong><?php echo $n['date'] ?></strong> <?php echo $n->h1 ?></p>
<?php endforeach ?>
$post = $pdo->prepare('SELECT * FROM post ORDER BY id DESC LIMIT 2');
$post->execute();
$news = $post->fetchAll(PDO::FETCH_BOTH);
<?php foreach ($news as $n): ?>
<p><strong><?php echo $n['date'] ?></strong> <?php echo $n->h1 ?></p>
<?php endforeach ?>
<?php
/** Для подстановки своих лимитов т.е переменных надо по сути оффнуть эмуляцию **/
/* пример выкл эмуляции при подстановке своих лимитов
$db->setAttribute( PDO::ATTR_EMULATE_PREPARES, false );
Включить думаю поймешь
*/
$stmt = $db->prepare($sql);
$stmt->execute($placeholders);
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($data as $dd)
{
print_r($dd);
}