-1
I need some help. What I’m trying to do is similar to the urban fish offerings, active while the time counter works and after the finish the information is replaced. but when use Lse does not work because the first condition remains true and if use one more if it adds the closed promotion information along with those of active promotion. How can I create this condition correctly? Note: I am beginner rs
<?php
$sql = $pdo->prepare("SELECT * FROM estabelecimentos ORDER BY rand() LIMIT 4");
$sql->execute();
$portal = $sql->fetchAll();
?>
<?php
$currentDateTime = date('Y-m-d H:i:s');
foreach($portal as $key => $value) {
?>
<div class="col s12 m3">
<div class="card">
<div class="card-image">
<?php echo '<img src="data:image/jpg;base64,'.base64_encode( $value['imagem'] ).'"/>'; ?>
</div>
<div class="card-content">
<span class="card-title"><?php echo $value['nome']; ?></span>
<h5><?php echo $value['produto']; ?></h5>
<?php if($value['status'] == 'promo'){ ?>
<div class="ticket">
<span><img src="img/flame.png" alt=""></span>
<span>Promoção turbinada</span>
</div>
<p><span class="promo"><?php echo 'A partir de '.'R$'.$value['promo']. ',00'; ?></span></p>
<div class="countdown" data-date="<?php echo $value['fimpromo']; ?>" data-time="<?php echo $value['datetime']; ?>"></div>
<?php } if ($value['fimpromo']<= $currentDateTime) { ?>
<div class="ticket ticket-closed">
<span><img src="img/cancel.png" alt=""></span>
<span>Promoção Encerrada</span>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
Thank you very much!! It worked!
– Marcos De Barros Azevedo