Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $filename = 'dataPelanggan';
- header("Content-type: application/vnd.ms-excel");
- header("Content-Disposition: attachment;Filename=".$filename.".xls");
- ?>
- <h1>Data Pelanggan</h1>
- <p>
- <?php echo $_POST['HARI'] ?>
- </p>
- <?php
- if($_POST)
- {
- $con = mysql_connect("localhost", "root", "root") or
- die("Error: " . mysql_error());
- mysql_select_db("pln2", $con);
- $date = $_POST['date'];
- $sql="SELECT
- a.NM, b.ID_PEL, b.NO_METER, b.DY_BR, b.GARDU,
- b.TIANG, b.TGL, c.C_TIM, b.HARI
- FROM
- tm_plg a, td_plg b, t_tim c
- where
- a.ID_PEL=b.ID_PEL and
- a.C_TIM=c.C_TIM and
- a.STATUS_KSR=0 and
- a.STATUS_MAT=0 and
- b.TGL like '$date%' ";
- $result = mysql_query($sql)or die(mysql_error());
- /*
- pastikan dari point ini.. tampilannya BENAR!!
- */
- ?>
- <hr />
- <table width="86%" class="display" id="datatables" border="1" >
- <thead>
- <tr>
- <th width="118">Hari</th>
- <th width="118">Tanggal</th>
- <th width="118">TIM</th>
- <th width="118">Nama</th>
- <th width="129">Id Pelanggan</th>
- <th width="145">Nomor Meter</th>
- <th width="60">Daya</th>
- <th width="77">Gardu</th>
- <th width="77">Tiang</th>
- </tr>
- <?php
- while ($row = mysql_fetch_array($result)) {
- ?>
- <tr>
- <td><? echo trim($row['HARI']); ?></td>
- <td><? echo trim($row['TGL']); ?></td>
- <td><? echo trim($row['C_TIM']); ?></td>
- <td><? echo trim($row['NM']); ?></td>
- <td>trim() <? echo trim($row['ID_PEL']); ?></td>
- <td><? echo trim($row['NO_METER']); ?></td>
- <td><? echo trim($row['DY_BR']); ?></td>
- <td><? echo trim($row['GARDU']); ?></td>
- <td><? echo trim($row['TIANG']); ?></td>
- </tr>
- <?php
- } ?>
- </thead>
- </table>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement