Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:28:43+00:00 2026-06-05T02:28:43+00:00

Hi i have a repeating recordset, in which i want to hide some entry(html

  • 0

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']?>">&raquo; Download &raquo;</a></div>    
<div class="category-buy-btn"><a href="<?php echo $list['buy']?>">&laquo; Buy &laquo;</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']?>">&laquo; Buy &laquo;</a></div>

content of $list['buydiv'] will then have these values.

<div class="category-buy-btn"><a href="<?php echo $list['buy']?>">&laquo; Buy &laquo;</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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:28:44+00:00Added an answer on June 5, 2026 at 2:28 am

    Just make it conditional on $list['buy'] being non-empty:

    <?php if (!empty($list['buy'])) : ?>
    <div class="category-buy-btn"><a href="<?php echo $list['buy']?>">&laquo; Buy &laquo;</a></div>    
    <?php endif ?>
    

    Update: In order to make sure your UTF-8 strings are displayed correctly, you need to tell the browser to interpret the page as UTF-8:

    header('Content-Type: text/html; charset=UTF-8');
    

    and make sure your SQL queries are being run as UTF-8:

    mysql_query("SET NAMES 'utf8'");
    

    See this for more info, and see this for a more exhaustive guide to Unicode in PHP. It’s potentially quite a confusing topic, so it’s worth reading about. This is also very instructive reading:

    The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div container which has a repeating background image that forms a
I have a list which has repeating items and I want a list of
I have a database that has been populated with some data using create and
I have a database table that contains some records to be processed. The table
Just want to get some views/possible leads on an issue I have. I have
I've got a scenario where I have a database with one table that gets
I have a sharepoint list which has several fields. It seems that when a
We have an audit table in our database, and on update the old and
Hello I have repeating table on my infopath form. It is bound with xml
I have a task tracking application, which is very basic. It currently has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.