Oj, bez obrazy @ariva6152, ale masz tu trochę "namieszane" , uporządkujmy to:
<?php
// Tu wcześniejszy kod ...
$result = mysqli_query($connect, $query);
$posts = mysqli_fetch_all($result, MYSQLI_ASSOC);
if(mysqli_num_rows($posts > 0) {
foreach ($posts as $post) {
echo '<div class="well well-lg">'
.'<h3>'.$post['tytul'].'</h3>'
.'<span class="glyphicon"></span>'
.'<small> '.$post['lokalizacja'].' </small>'
.'<p>'.$post['tresc'].'</p></div>';
}
} else {
echo "brak rekordów";
}
?>
... lub ewentualnie ...
<?php
// Tu wcześniejszy kod ...
$result = mysqli_query($connect, $query);
$posts = mysqli_fetch_all($result, MYSQLI_ASSOC);
if(mysqli_num_rows($posts > 0) {
foreach ($posts as $post) {
$output = '<div class="well well-lg">'
.'<h3>'.$post['tytul'].'</h3>'
.'<span class="glyphicon"></span>'
.'<small> '.$post['lokalizacja'].' </small>'
.'<p>'.$post['tresc'].'</p></div>';
}
} else {
$output = 'brak rekordów';
}
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
</head>
<body>
<div class="post-container"><?php echo $output; ?></div>
</body>
</html>