$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>
您可以看到我放了LIMIT 4
。我希望它在用户每次刷新页面或进入另一个页面时显示不同的记录。我该怎么办?
答案 0 :(得分:0)
尝试使用
ORDER BY rand() LIMIT 4
代替
LIMIT 4