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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:31:35+00:00 2026-05-31T13:31:35+00:00

I want to show table like : | | qty | S rank |

  • 0

I want to show table like :

|             |  qty | S rank | A rank | B rank | C rank |
+--------------------------------------------------------+  
| TODAY       |  12  |   0    |   0    |    0   |    0   |    //THIS CURRENT DATA
+--------------------------------------------------------+
|MONTHLY TOTAL| 200  |   1    |   0    |    0   |    0   |    //THIS MONTHLY DATA
+--------------------------------------------------------+

The table above will show after echoing mysql result use PHP. How to combine tWo case become one table after echo? using double $sql or something else use PHP ?
So far, I’m success during echo current data, but for Monthly data i’ve become confuse how to deciding which way that should I try to do.

CURRENT DATA script:

..........
$sql = " SELECT COUNT(Serial_number) AS n, SUM(S) AS S,SUM(A) AS A, SUM(B) AS B, SUM(C) AS C
FROM inspection_report WHERE Model LIKE 'KD-R306TUND' AND Lot_no LIKE '066A' AND Line LIKE 'FA 01' AND Range_sampling ='087X0001-087X0400' GROUP BY Range_sampling";
$result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
echo "<table border='1' width='500'>";
echo "<caption>INSPECTION REPORT</caption>";
echo "<thead><tr>";
echo "<td colspan='3'></td>";
echo "<th>n</th><th>S</th><th>A</th><th>B</th><th>C</th>";
echo "</tr></thead>";
echo "<tbody>";
while($row=mysql_fetch_array($result)){
        echo "<tr><th rowspan='2'>JUDGE</td><td id='acc' bgcolor='grey'>ACCEPT</td><th>TODAY</th><td>";
        echo $row['n'];
        echo "</td><td>";
        echo $row['S'];
        echo "</td><td>";
        echo $row['A'];
        echo "</td><td>";
        echo $row['B'];
        echo "</td><td>";
        echo $row['C'];
        echo "</td></tr>";
        }
echo "</tbody></table>";
mysql_close($dbc);
?>

This query for count MONTHLY data :

SELECT COUNT(Serial_number) AS n, SUM(S) AS S,SUM(A) AS A, SUM(B) AS B, SUM(C) AS C
FROM inspection_report WHERE Inspection_datetime <=
     ( SELECT DATE(MAX(Inspection_datetime)) FROM inspection_report
       WHERE Model LIKE 'KD-R306TUND' AND Lot_no LIKE '066A'
       AND Line LIKE 'FA 01' AND Range_sampling ='087X0001-087X0400' )
AND MONTH(Inspection_datetime)=MONTH(CURRENT_DATE) AND Line ='FA 01'

could I get the result like above table ?

  • 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-05-31T13:31:36+00:00Added an answer on May 31, 2026 at 1:31 pm

    From your suggested structure, it contain 3 rows and 6 fields. Now, let’s get back to Basic HTML 101.

    To create a table, you need:

    <table></table>
    

    To create row and columns, you need:

    <tr><!-- start of row -->
        <td><!-- start of field 1 -->
            {table's field 1 content}
        </td><!-- end of field 1 -->
        <td><!-- start of field 2 -->
            {table's field 2 content}
        </td><!-- end of field 2 -->
    </tr><!-- end of row -->
    

    For more information about how to create HTML table.

    Now, back to your case. You already create the first and second rows and by this, you should already understand how to do it.

    So, when you need to append another table row, all you have to do is insert the table row code.

    Just before:

    echo "</tbody></table>";
    

    You do the second (monthly) query and echo it’s value, eg:

    $sql = "{your sql query}";
    $result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
    
    
    while($row=mysql_fetch_array($result)){
        echo "<tr><th rowspan='2'>JUDGE</td><td id='acc' bgcolor='grey'>ACCEPT</td><th>MONTHLY TOTAL</th><td>";
        echo $row['{field_name}'];
        echo "</td><td>";
        .
        .
        .
        echo "</td></tr>";
    }
    echo "</tbody></table>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show a JSON data at my table as like here: example
I have a table with many rows of data, and I want to show
I am using SQL Server 2000. My table show data like when I issue
This code works like a charm to show/hide table rows based on selected filters.
In sql I want to show statistics data, so I'd like to show sums
I want to show a listbox(Table) with nearly 20 Million rows. How can I
I want to show nine images in a table , three images in each
I simply want to show off a model in a table that is paginated
I want show annotation view (above one of my pin) after load map. For
i want to show a grapph/bar chart in iphone how do i do this

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.