This question already has an answer here:
- Selecting Random Rows in MySQL 3 answers
- Select random rows from mysql table [duplicate] 3 answers
$publicacoesIDrow2 = DBRead('publicacao', "LIMIT 4");
<div class="container">
<div class="row">
<?php foreach ($publicacoesIDrow2 as $IDr2): ?>
<div class="col-12 col-md-6 col-lg-4 mb-3 mb-md-0">
<div class="card">
<div class="img-container">
<a href="index.php?post=<?php echo $IDr2['title']?>"><img src="<?php echo $IDr2['capa']?>" alt="<?php echo $IDr2['alt']?>" class="card-img-top"></a>
</div>
<div class="card-body">
<a href="index.php?post=<?php echo $IDr2['title']?>" class="card-title cardTitleLink"><h1 class="cardTitle"><?php echo $IDr2['title']?></h1></a>
<p class="card-text text-muted"><?php echo $IDr2['text']?></p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
As you can see i putted a LIMIT 4
. I want it to display a different record every time the user refreshes a page or enters another page. How can i do it?
Aucun commentaire:
Enregistrer un commentaire