(Added [code]...[/code] tags ~ MOD)

I need the else to do nothing but I want the <hr> line to go underneath each client, its doing that but its also putting "extra" lines for the "else" that aren't showing up so I'm getting 3 extra lines (exactly how many 'Premium' == 'N'). I'm a complete noob trying to learn PHP and HTML and all of it... What am I doing wrong?

<div class="container client">
<?php $pages = find_clients_by_category_id($category_id); ?>
    <div class="row" style="align-items: flex-start">
		<div class="col"> 				
     <?php while($page = mysqli_fetch_assoc($pages)) { ?>
			<div class="row">		           	  
<?php
if($page['Premium'] == 'Y') { ?> <section class="col-sm-7 col-md-6 col-lg-5 col-xl-4"> <a href="<?php echo h($page['URL']); ?>" target="new"> <img src="../../images/premium/<?php echo "$image_category/" ?> <?php echo h($page['ListingPhoto']); ?>" class="img-fluid" alt="Add 1"> </section> <section class="col-sm-4 col-md-6"> <h4><?php echo h($page['Client_Name']); ?></h4> <h5><a style="text-decoration-color: #000000;" href="tel:1-508-680-4180"><?php echo h($page['Telephone']); ?></a> <?php echo h($page['Address']); ?></h5><p><?php echo h($page['Blurb']); ?></p></a> </section> <?php } else {} ?> </div> **<hr>**
<?php } ?> </div> </div>

    I'm a bit lost trying to go through that, but from the question about the HR element, does it just need to be moved up inside the the if block? It also looks like the last </a> closing tag probably needs to be moved up to close the first <a> tag, but that's a separate issue.

    Welcome to the difficulty of intermingling HTML and PRS -- it's usually better to separate them as much as possible, in order to aid readbility -- but that's a whole other topic. 🙂

      Write a Reply...