Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('koneksi.php');
- $query=mysql_query("select * from data order by tgl") or die ("Query error");
- ?>
- <table border="1">
- <tr>
- <th>No.</th>
- <th>Tanggal</th>
- <th>Nama</th>
- <th>Jumlah</th>
- </tr>
- <?php
- $no=1;
- while($data=mysql_fetch_array($query)){
- $ts1 = strtotime($dtBefore);
- $ts2 = strtotime($data[tgl]);
- $seconds_diff = $ts2 - $ts1;
- $dtdiff = floor($seconds_diff/3600/24);
- if($no > 1 && $dtdiff > 1){
- for($x = 1;$x < $dtdiff;$x ++){
- $dtTemp = date('Y-m-d', strtotime("+$x days", strtotime($dtBefore)));
- echo"
- <tr>
- <td>$no</td>
- <td>$dtTemp</td>
- <td></td>
- <td></td>
- </tr>
- ";
- $no++;
- }
- }
- ?>
- <tr>
- <td><?php echo $no++; ?></td>
- <td><?php echo $data['tgl']; ?></td>
- <td><?php echo $data['nama']; ?></td>
- <td><?php echo $data['jumlah']; ?></td>
- </tr>
- <?php
- $dtBefore = $data['tgl'];
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement