I have a problem w/ the Below code, that when I view the table, it repeats the Headers for each row. :

For instance:

comed_zone	chicagogen_hub	chicago_hub	nillinois_hub
10	30.8	30.4	30.8	30.6
comed_zone	chicagogen_hub	chicago_hub	nillinois_hub
11	29.0	28.2	29.2	28.8
comed_zone	chicagogen_hub	chicago_hub	nillinois_hub
12	28.2	27.5	28.4	28.3

Is there a reason this does this? .. I've tried doing all types of things, if i move up the free result and put the do /while around one column, then it would be fine. Although then i cant reinitiate the Do/while to make it for each individual table.


Any work around or other mysql command i should look at ? Or should i just do individual queries for each table?

Thank you.

mysql_select_db($database_pjm, $pjm);
$query_rtlmp_graph = "SELECT dcmdva_rtlmphr.`time`, dcmdva_rtlmphr.baltimore_zone, dcmdva_rtlmphr.pepco_zone, dcmdva_rtlmphr.dominion_zone, dcmdva_rtlmphr.dominion_hub, dcmdva_rtlmphr.`time`, il_rtlmphr.comed_zone, il_rtlmphr.chicagogen_hub, il_rtlmphr.chicago_hub, il_rtlmphr.nillinois_hub, oh_rtlmphr.aep_zone, oh_rtlmphr.dayton_zone, oh_rtlmphr.fe_zone, oh_rtlmphr.deok_zone, oh_rtlmphr.aepgen_hub, oh_rtlmphr.dayton_hub, oh_rtlmphr.atsife_hub, oh_rtlmphr.ohio_hub, oh_rtlmphr.westint_hub, pa_rtlmphr.philelec_zone, pa_rtlmphr.ppl_zone, pa_rtlmphr.meted_zone, pa_rtlmphr.pennelec_zone, pa_rtlmphr.allegheny_zone, pa_rtlmphr.duq_zone, pa_rtlmphr.eastern_hub, pa_rtlmphr.western_hub, njde_rtlmphr.pseg_zone, njde_rtlmphr.jpcl_zone, njde_rtlmphr.atlcity_zone, njde_rtlmphr.rockland_zone, njde_rtlmphr.delmarva_zone, njde_rtlmphr.nj_hub FROM dcmdva_rtlmphr
LEFT JOIN il_rtlmphr ON dcmdva_rtlmphr.`id`= il_rtlmphr.`id` AND il_rtlmphr.`date`=dcmdva_rtlmphr.`date`
LEFT JOIN oh_rtlmphr ON dcmdva_rtlmphr.`id`= oh_rtlmphr.`id` AND oh_rtlmphr.`date`=dcmdva_rtlmphr.`date`
LEFT JOIN pa_rtlmphr ON dcmdva_rtlmphr.`id`= pa_rtlmphr.`id` AND pa_rtlmphr.`date`=dcmdva_rtlmphr.`date`
LEFT JOIN njde_rtlmphr ON dcmdva_rtlmphr.`id`= njde_rtlmphr.`id` AND njde_rtlmphr.`date`=dcmdva_rtlmphr.`date`
WHERE dcmdva_rtlmphr.`date`='".$pjmGraphdate."'";
$rtlmp_graph = mysql_query($query_rtlmp_graph, $pjm) or die(mysql_error());
$row_rtlmp_graph = mysql_fetch_assoc($rtlmp_graph);
$totalRows_rtlmp_graph = mysql_num_rows($rtlmp_graph);


<body>  <?php do { ?>
<!--DCMDVA GRAPH-->
<table border="0" id="dcmdRtlmp" style="display:none;">
  <tr>
    <th></th>
    <th scope="col">baltimore_zone</th>
    <th scope="col">pepco_zone</th>
    <th scope="col">dominion_zone</th>
    <th scope="col">dominion_hub</th>    
  </tr>
      <tr>
      <th scope="row"><?php echo $row_rtlmp_graph['time']; ?></th>
      <td><?php echo $row_rtlmp_graph['baltimore_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['pepco_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['dominion_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['dominion_hub']; ?></td>     
    </tr>

</table>
<!--IL GRAPH -->
<table border="0" id="ilRtlmp" style="display:block;">
  <tr>
    <th></th>
    <th scope="col">comed_zone</th>
    <th scope="col">chicagogen_hub</th>
    <th scope="col">chicago_hub</th>
    <th scope="col">nillinois_hub</th>
  </tr>

    <tr>
      <th scope="row"><?php echo $row_rtlmp_graph['time']; ?></th>
      <td><?php echo $row_rtlmp_graph['comed_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['chicagogen_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['chicago_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['nillinois_hub']; ?></td>
    </tr>

</table>
<!--OH GRAPH-->
<table border="0" id="ohRtlmp" style="display:none;">
  <tr>
    <th></th>   
    <th scope="col">aep_zone</th>
    <th scope="col">dayton_zone</th>
    <th scope="col">fe_zone</th>
    <th scope="col">deok_zone</th>
    <th scope="col">aepgen_hub</th>
    <th scope="col">dayton_hub</th>
    <th scope="col">fe_hub</th>
    <th scope="col">ohio_hub</th>
    <th scope="col">westint_hub</th>
  </tr>


    <tr>
      <th scope="row"><?php echo $row_rtlmp_graph['time']; ?></th>
      <td><?php echo $row_rtlmp_graph['aep_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['dayton_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['fe_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['deok_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['aepgen_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['dayton_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['atsife_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['ohio_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['westint_hub']; ?></td>
    </tr>

</table>
<!--PA GRAPH-->
<table border="0" id="paRtlmp" style="display:none;">
  <tr>
    <th></th>
    <th scope="col">philelec_zone</th>
    <th scope="col">ppl_zone</th>
    <th scope="col">meted_zone</th>
    <th scope="col">pennelec_zone</th>
    <th scope="col">allegheny_zone</th>
    <th scope="col">duq_zone</th>
    <th scope="col">eastern_hub</th>
    <th scope="col">western_hub</th>
  </tr>


    <tr>
      <th scope="row"><?php echo $row_rtlmp_graph['time']; ?></th>
      <td><?php echo $row_rtlmp_graph['philelec_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['ppl_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['meted_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['pennelec_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['allegheny_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['duq_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['eastern_hub']; ?></td>
      <td><?php echo $row_rtlmp_graph['western_hub']; ?></td>
    </tr>
   
</table>
<!--NJ DE GRAPH-->
<table border="0" id="njdeRtlmp" style="display:none;">
  <tr>
    <th></th>
    <th scope="col">pseg_zone</th>
    <th scope="col">jpcl_zone</th>
    <th scope="col">atlcity_zone</th>
    <th scope="col">rockland_zone</th>
    <th scope="col">delmarva_zone</th>
    <th scope="col">nj_hub</th>
  </tr>
 

    <tr>
      <th scope="row"><?php echo $row_rtlmp_graph['time']; ?></th>
      <td><?php echo $row_rtlmp_graph['pseg_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['jpcl_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['atlcity_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['rockland_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['delmarva_zone']; ?></td>
      <td><?php echo $row_rtlmp_graph['nj_hub']; ?></td>
    </tr>
       <?php } while ($row_rtlmp_graph = mysql_fetch_assoc($rtlmp_graph)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($rtlmp_graph);
?>

try taking this out of your do-while loops..

<table border="0" id="dcmdRtlmp" style="display:none;">
<tr>
<th></th>
<th scope="col">baltimore_zone</th>
<th scope="col">pepco_zone</th>
<th scope="col">dominion_zone</th>
<th scope="col">dominion_hub</th>
</tr>

something like this

<table border="0" id="dcmdRtlmp" style="display:none;">
<tr>
<th></th>
<th scope="col">baltimore_zone</th>
<th scope="col">pepco_zone</th>
<th scope="col">dominion_zone</th>
<th scope="col">dominion_hub</th>
</tr>

<?php 
do{ //whatever here 

}
while{ //whatever is true 

}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.