Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // function datatable
- function viewData(){
- $(document).ready(function() {
- $('.data').DataTable({
- "processing": true,
- "serverSide": true,
- "ajax": "core/process.php",
- success : function(data){
- $('tbody').html(data);
- }
- })
- });
- }
- //query dengan pdo
- $stmt = $db->prepare("SELECT * FROM pelanggan");
- $stmt->execute();
- $no = 1;
- while($row = $stmt->fetch()){
- ?>
- <tr>
- <?php $result[]=$row;?>
- <td><?php echo $no++;?></td>
- <td><?php echo $row['id_pelanggan'];?></td>
- <td><?php echo $row['nm_pelanggan'];?></td>
- <td><?php echo $row['alamat'];?></td>
- <td><?php echo $row['telepon'];?></td>
- <td><?php echo $row['email'];?></td>
- <td width="160">
- <button class="btn btn-warning" data-toggle="modal" data-target="#edit-<?php echo $row['id_pelanggan']; ?>">Edit</button>
- <button type="button" class="btn btn-danger" onclick="deleteData(<?php echo $row['id_pelanggan']?>)"> Delete </button>
- </td>
- </tr>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement