When calling the jquery function php is returning other columns -
this jquery:
<script> (function($) { $(document).ready(function() { var $container = $("#info_e1"); var refreshid = setinterval(function() { $container.load('stare-e1.php'); }, 5000); }); })(jquery); </script>
inside table have
<tr id='info_e1'> <?php include 'stare-e1.php'?> </tr>
and php looks this:
<?php ...... $stmt = $db->query($query); $result = $stmt -> fetchall(); foreach( $result $row ) { echo "<td><strong>producator</strong></td>"; echo "<td>".$row['producator']."</td></tr>"; echo "<tr><td><strong>microcontroler:port</strong></td>"; echo "<td>".$row['uc'].":".$row['port']."</td></tr>"; echo "<tr><td><strong>durata de aprovizionare</strong></td>"; echo "<td>".$row['durata_aprovizionare']."</td></tr>"; echo "<tr><td><strong>durata de viata</strong></td>"; echo "<td>".$row['durata_viata']."</td></tr>"; echo "<tr><td><strong>durata totala</strong></td>"; echo "<td>".$row['durata_totala']."</td></tr>"; echo "<tr><td><strong>ultima aprovizionare</strong></td>"; echo "<td>".$row['data_aprov']." , ".$row['ora_aprov']."</td></tr>"; echo "<tr><td><strong>starea</strong></td>"; echo "<td>".$row['starea']."</td>"; }?>
when page loads, result of stare-e1.php displayed perfectly. after 5 seconds, jquery reloads '#info-e1' instead of having first row
<td><strong>producator </strong></td> <td></strong> fetched column of 'producator' </strong></td>
it changes to
<td><strong>starea</strong></td> <td></strong> fetched column of 'starea' </strong></td> ....
am missing something? cant figure out why doing this? on reloading column starea appears twice in table, @ beginning instead of 'producator' , @ end should be. , if change value mysql of 'starea' updated value displayed on first row 'producator' should , on last row duplicate is, remains old value.... suggestions?
Comments
Post a Comment