function get_footer()
{
global $link;
$sql = "SELECT * FROM footer";
$result = mysqli_query($link, $sql);
$posts = array();
while ($row = $result->fetch_assoc()) {
$posts[] = $row;
}
return $posts;
}
<?php foreach ($posts as $post) : ?>
<div class="col-xl-6">
<img src="img/logo.svg" alt="logo" class="logo_footer">
<p><?php echo $post['description'] ?></p>
</div>
<div class="col-xl-3">
<h5><?php echo $post['title'] ?></h5>
<p><?php echo $post['description'] ?></p>
</div>
<div class="col-xl-3">
<h5><?php echo $post['title'] ?></h5>
<p><?php echo $post['description'] ?></p>
</div>
<?php endforeach; ?>
function get_footer()
{
global $link;
$sql = "SELECT * FROM footer WHERE id in (1, 2, 3)";
$result = mysqli_query($link, $sql);
$posts = array();
while ($row = $result->fetch_assoc()) {
$postId = $row['id'];
$posts[$postId] = $row;
}
return $posts;
}
<div class="col-xl-6">
<img src="img/logo.svg" alt="logo" class="logo_footer">
<p><?php echo $posts[1]['description'] ?></p>
</div>
<div class="col-xl-3">
<h5><?php echo $posts[2]['title'] ?></h5>
<p><?php echo $posts[2]['description'] ?></p>
</div>
<div class="col-xl-3">
<h5><?php echo $posts[3]['title'] ?></h5>
<p><?php echo $post[3]['description'] ?></p>
</div>