Advertisement
irfanamir

index.php

Nov 12th, 2020
2,265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <title>Dashboard</title>
  7.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
  8.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  9.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js"></script>
  10.     <style type="text/css">
  11.         body{ font: 14px sans-serif; text-align: center; }
  12.         .wrapper{
  13.             width: 650px;
  14.             margin: 0 auto;
  15.         }
  16.         .page-header h2{
  17.             margin-top: 0;
  18.         }
  19.         table tr td:last-child a{
  20.             margin-right: 15px;
  21.         }
  22.     </style>
  23.     <script type="text/javascript">
  24.         $(document).ready(function(){
  25.             $('[data-toggle="tooltip"]').tooltip();
  26.         });
  27.     </script>
  28. </head>
  29. <body>
  30.         <div class="page-header">
  31.         <h1></b>NISA WEB</h1>
  32.     </div>
  33.  
  34.     <div class="wrapper">
  35.         <div class="container-fluid">
  36.             <div class="row">
  37.                 <div class="col-md-12">
  38.                     <div class="page-header clearfix">
  39.                         <h2 class="pull-left">Informasi Pegawai</h2>
  40.                         <a href="create.php" class="btn btn-success pull-right">Tambah Baru</a>
  41.                     </div>
  42.                     <?php
  43.                     // Include config file
  44.                     require_once "config.php";
  45.  
  46.                     // Attempt select query execution
  47.                     $sql = "SELECT * FROM employees";
  48.                     if($result = mysqli_query($link, $sql)){
  49.                         if(mysqli_num_rows($result) > 0){
  50.                             echo "<table class='table table-bordered table-striped'>";
  51.                                 echo "<thead>";
  52.                                     echo "<tr>";
  53.                                         echo "<th>No</th>";
  54.                                         echo "<th>Nama</th>";
  55.                                         echo "<th>Alamat</th>";
  56.                                         echo "<th>Salary</th>";
  57.                                         echo "<th>Pengaturan</th>";
  58.                                     echo "</tr>";
  59.                                 echo "</thead>";
  60.                                 echo "<tbody>";
  61.                                 while($row = mysqli_fetch_array($result)){
  62.                                     echo "<tr>";
  63.                                         echo "<td>" . $row['id'] . "</td>";
  64.                                         echo "<td>" . $row['name'] . "</td>";
  65.                                         echo "<td>" . $row['address'] . "</td>";
  66.                                         echo "<td>" . $row['salary'] . "</td>";
  67.                                         echo "<td>";
  68.                                             echo "<a href='read.php?id=". $row['id'] ."' title='View Record' data-toggle='tooltip'><span class='glyphicon glyphicon-eye-open'></span></a>";
  69.                                             echo "<a href='update.php?id=". $row['id'] ."' title='Update Record' data-toggle='tooltip'><span class='glyphicon glyphicon-pencil'></span></a>";
  70.                                             echo "<a href='delete.php?id=". $row['id'] ."' title='Delete Record' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
  71.                                         echo "</td>";
  72.                                     echo "</tr>";
  73.                                 }
  74.                                 echo "</tbody>";
  75.                             echo "</table>";
  76.                             // Free result set
  77.                             mysqli_free_result($result);
  78.                         } else{
  79.                             echo "<p class='lead'><em>No records were found.</em></p>";
  80.                         }
  81.                     } else{
  82.                         echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
  83.                     }
  84.  
  85.                     // Close connection
  86.                     mysqli_close($link);
  87.                     ?>
  88.                 </div>
  89.             </div>
  90.         </div>
  91.     </div>
  92. </body>
  93. </html>
  94.  
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement