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 8785881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:28:10+00:00 2026-06-13T21:28:10+00:00

i have page where i populate table from mysql using php. I have 10

  • 0

i have page where i populate table from mysql using php. I have 10 tables.
If there is no data in table then the table is not displayed.

i have displayed numbering like “1” for table one 2 for table 2 and so on . now if table 3,6,9 have no data then page will display table of numbers 1,2,4,5,7,8,10. but i want that numbring according to the number of tables displayed.

$tbl2= "SELECT * FROM wp_health_aanvullend_moduliar WHERE health_id=$hid";
$rs2 = mysql_query($tbl2);
$count2 = mysql_num_rows($rs2);

 <?php if($count2 > 0){?>

<table class="sub_front_efect" cellpadding="0" cellspacing="0" style=" border:none; margin:10px 0;">
<thead>
    <tr>
      <th colspan="100%" class="health_sub_front">Aanvullend moduliar</th></tr>
</thead>
<tbody>

<?php  $wp_health_aanvullend_moduliar = "wp_health_aanvullend_moduliar";
             $crows = $wpdb->get_results( "SELECT * FROM $wp_health_aanvullend_moduliar WHERE health_id=$hid");
              foreach ($crows as $crow) {
                 $type          = $crow->type ;
                 $price         = $crow->price;


              ?>
    <tr data-price="<?php echo $price; ?>"><td width="65%"><?php echo $type; ?></td><td style="border-right:1px solid #ccc;">&euro; <?php echo $price; ?></td></tr>
    <?php 
              }
    ?>
  </tbody>

<?php } ?>

if all the table has data then all displayed.tables with numbers
what can be the logic

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-13T21:28:11+00:00Added an answer on June 13, 2026 at 9:28 pm

    You should use a counter inside the loop where you displaying the tables. In all tables without content the counter wouldn’t be increase.

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

Sidebar

Related Questions

I have a table on my php page populated with data from a MySQL
I have a GridView using LinqDataSource to populate data from table Tickets . The
I have a html table in my page that I populate with items from
I populate the data from my table using a loadResults routine which runs on
I have a PHP page that queries a DB to populate a form for
I currently am using mysql and php to display 9 random results from my
I have a form for updating user data. It posts to this page: <?php
I have populated an html page with a table from the database. I want
I have a working mysql query that retrieves data from table1. Now I will
I have a search page that uses jQuery to populate a table with search

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.