处理与PHP中的条件链接[重复]

This question already has an answer here:

I want to make link with condition. i have a database table named admin. there is a field name registration. if that value is Y then i redirect this otherwise no that's i am expecting. if anyone suggest me it will so much helpful.

  $sql4 = "SELECT * FROM admin ";
  $result4 = mysqli_query($con,$sql4);
  $row4 = mysqli_fetch_array($result4,MYSQLI_ASSOC);
  $re = $row4['registration'];
 /////////////////////////////////////////////
 <a href = <?php if ($re='Y') { ?> "registration.php" <?php } 
else {echo "no";}?>class = "btn btn-primary btn-lg" role = "button">
             Registration
           </a>
</div>

You're using an assignment:

($re='Y')

You need a comparison:

($re=='Y')

You can achieve this is may ways. The easiest would be:

<?php if ($re == 'Y') : ?>
  <a href="registration.php" class="btn btn-primary btn-lg" role="button">Registration</a>
<?php else: ?>
  <a href="login.php" class="btn btn-primary btn-lg" role="button">Login</a>
<?php endif; ?>