Hi i have a repeating recordset, in which i want to hide some entry(html div) in a row as required. my database has a table with 7 columns, now i have a condition when i dont wont to display a entry(element) in a row.
to explain further please look at my html code block.
<?php do { ?>
<div class="category-container">
<div class="category-image"><?php echo $list['image']?></div>
<div class="category-desc"> <a href="<?php echo $list['titlelink']?>"><?php echo $list['title']?></a>
<p><?php echo $list['description']?></p></div>
<div class="rating<?php echo $list['rating']?>" >Editors' rating: </div>
<div class="category-download-btn"><a href="<?php echo $list['download']?>">» Download »</a></div>
<div class="category-buy-btn"><a href="<?php echo $list['buy']?>">« Buy «</a></div>
</div> <?php } while ($list = mysql_fetch_assoc($result2)); ?>
i have a div ("class=category-buy-btn"
) which i want to hide in case when there is no buy link, i have set it fetch url from database.
A simple approach to do this that come to me is making a new column 'buydiv' and putting the entire div in this column 'buydiv' and not to put value in row which i dont want to show, like this.
<?php echo $list['buydiv']?>
in place of
<div class="category-buy-btn"><a href="<?php echo $list['buy']?>">« Buy «</a></div>
content of $list['buydiv']
will then have these values.
<div class="category-buy-btn"><a href="<?php echo $list['buy']?>">« Buy «</a></div>
Now this is really not a good aproach to do it, can someone please suggest me any better way to do it.
Thanks.