0
I am trying to use Bootstrap4 Timeline but am having problems working with database.
The Bootstrap Timeline is displayed alternately, that is, a record is positioned on the left, and the next on the right, according to the use of the class "Timeline-Inverted" na < li >.
If I do a "foreach ($Row as $key => $line)" and place an echo using the query result, all records will come from the same side. In order to alternate, one record must be < li > and the other must be < li class="Timeline-Inverted" >
How do I do this in consultation?
My code is like this:
<ul class="timeline">
<?php
$sql = "SELECT
povos.pv,
povos.avatar
povos.content
FROM povos
WHERE povos.regiao='1'";
$res = $PDO->query($sql);
$row = $res->fetchAll(PDO::FETCH_ASSOC);
foreach ($row as $key => $linha) {
$pv = $linha['pv'];
$avatar = $linha['avatar'];
?>
<li> // essa vem do lado esquerdo
<div class="timeline-badge"><i class="fa fa-check"></i>
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title"><?php echo $pv; ?></h4>
<p><small class="text-muted"><i class="fa fa-clock-o"></i> <?php echo $avatar; ?></small>
</p>
</div>
<div class="timeline-body">
<p><?php echo $content; ?></p>
</div>
</div>
</li>
<?php
}
?>
<li class="timeline-inverted"> // Essa que eu não estou conseguindo fazer vir do lado direito...
<div class="timeline-badge warning"><i class="fa fa-credit-card"></i>
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">Lorem ipsum dolor</h4>
</div>
<div class="timeline-body">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Autem dolorem quibusdam, tenetur commodi provident cumque magni voluptatem libero, quis rerum. Fugiat esse debitis optio, tempore. Animi officiis alias, officia repellendus.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium maiores odit qui est tempora eos, nostrum provident explicabo dignissimos debitis vel! Adipisci eius voluptates, ad aut recusandae minus eaque facere.</p>
</div>
</div>
</li>
</ul>
I used the code, but it keeps coming all the way to the left...
– Webster Moitinho