Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74020

How to show a virtual table generated by MySQL in HTML page

$
0
0

I have this MySQL table MONTHNAME generated by querying from the database using the following script using PHP.

$query = 'SELECT monthname(`dateAdded`) as MONTHNAME,sum(`shift1PinCount`+`shift2PinCount`) from `supervisorupdate` WHERE YEAR(`dateAdded`) = YEAR(CURDATE()) group by monthname(`dateAdded`) ORDER BY monthname(`dateAdded`) DESC';
$queryExecute = mysqli_query($conn, $query);

I want to show this table as it is into my HTML page using PHP. As from I know normally we use

while($row = mysqli_fetch_array($queryExecute)){
   echo $row['someColumnName'];
}

In this case, I can't do that since I am doing some calculations and getting output as a table. Can someone guide me on how to show this table?

Edit 1

Here is a picture of the result that I am getting using phpMyadmin. So the HTML table should be similar to this

enter image description here

So for HTML side, it should show something like this

<table class="table">
  <thead>
    <tr>
      <th scope="col" id="month">Month</th>
      <th scope="col" id="sum">Sum</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row" id="jan">January</th>
      <td id="janPinCount">3456</td>
    </tr>
    <tr>
      <th scope="row" id="feb">February</th>
      <td id="febPinCount">443</td>
    </tr>

  </tbody>
</table>

Viewing all articles
Browse latest Browse all 74020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>