jeudi 25 mars 2021

how to disable anchor tag based on sql query

Why anchor tag still being executed when it does not meet the condition where the order status == 5?

 <?php
      $dwnsql="SELECT order_id, order_status FROM ordered_items GROUP BY order_id HAVING AVG(order_status) = '5' ORDER BY order_id";

      $dwnquery = $conn->query($dwnsql);
      if (mysqli_fetch_assoc($dwnquery)) {
          echo '
          <div class="col-4 form-group pull-right text-center pl-0">
          <a target="_blank"  href="receipt.php?order_id=' . $row['order_id'] . '"  
          class="btn addtocart" style="font-size: 12px;"><span class="iconify" data-icon="bx:bx-download" data-inline="false"></span> Receipt</a>
          </div>
          ';}

      ?>

Aucun commentaire:

Enregistrer un commentaire