Advertisement
oimtrust

index.php_crudImage-pdo-oop

Jan 2nd, 2017
1,678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.     //Memanggil file class.profile.php
  3.     require_once 'app/model/class.profile.php';
  4.  
  5.     $auth_pro   = new Profile();
  6.  
  7.     //Menampilkan data ke tabel
  8.     $stmt   = $auth_pro->runQuery("SELECT * FROM profile");
  9.     $stmt->execute();
  10.  
  11.     $result = null;
  12.     if ($stmt->rowCount() == 0) {
  13.     }
  14.     else {
  15.         while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
  16.             $result[]   = "<td>".$row['nama']."</td>
  17.                         <td><img src='photo/".$row['photo']."'
  18.                         class='img-rounded' width='115px' height='115px'></td>
  19.                         <td>
  20.                             <a class='btn btn-info' href='profile-edit.php?edit_ipro=".$row['id_profile']."'><span class='glyphicon glyphicon-edit'></span> Edit</a>
  21.                            <a class='btn btn-danger' href='?delete_ipro=".$row['id_profile']."'><span class='glyphicon glyphicon-remove-circle'></span> Delete</a>
  22.                        </td>";
  23.         }
  24.     }
  25.  
  26.     //Eksekusi untuk menghapus data
  27.     if (isset($_GET['delete_ipro'])) {
  28.         try {
  29.             if ($auth_pro->deleteProfile($ipro)) {
  30.                 $auth_pro->redirect('index.php?deleted');
  31.             }
  32.         } catch (PDOException $e) {
  33.             echo $e->getMessage();
  34.         }
  35.     }
  36.  
  37.     include 'app/view/header.blade.php';
  38.     include 'app/view/menu.blade.php';
  39.     include 'app/view/index.blade.php';
  40.     include 'app/view/footer.blade.php';
  41.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement