Deegroller

Untitled

Jul 22nd, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. in class.crud.php
  2.  
  3. public function dataview($query,$userid)
  4.  {
  5.   $stmt = $this->db->prepare($query);
  6.   $stmt->execute();
  7.  
  8.   if($stmt->rowCount()>0)
  9.   {
  10.    while($row=$stmt->fetch(PDO::FETCH_ASSOC))
  11.    {
  12.     ?>
  13.  
  14. <!-- VIEW STARTS HERE-->
  15. <div class="panel panel-default">
  16.  
  17.     <div class="panel-heading">#<?php print($row['quote_id']); ?>
  18.         <?php
  19.         if ($userid==$row['quote_user_id']) {
  20.             print(' <a class="editbutton" href="index.php?page=edit_quote&edit_id='.$row['quote_id'].'"><i class="glyphicon glyphicon-pencil"></i></a>');
  21.             print(' <a class="deletebutton" href="index.php?page=delete_quote&delete_id='.$row['quote_id'].'>"><i class="glyphicon glyphicon-remove"></i></a>');           
  22.         }      
  23.         ?>
  24.     </div>
  25.  
  26.       <div class="panel-body">
  27.         <?php print( nl2br($row['quote_content']) ); ?>
  28.       </div>
  29.     <?php $username = $this->getUsername( $row['quote_user_id'] ); ?>  
  30.     <div class="panel-footer">
  31.         <small>Posted by <a href="index.php?page=view_by_user&user=<?php print($row['quote_user_id']); ?>"><?php print($username); ?></a>, on <cite title="Source Title"><?php print($row['quote_date']); ?></cite></small>
  32.     </div>
  33.    
  34. </div>
  35.                 <?php
  36.    }
  37.   }
  38.   else
  39.   {
  40.    ?>
  41.             <p>Nothing here...</p>
  42.             <?php
  43.   }
  44.  
  45.  }
  46.  
  47.  
  48. En verder in de viewquote.php
  49. <div class="content-wrapper">
  50.         <div class="container">
  51.             <div class="row">
  52.                 <div class="col-md-12">
  53.                     <h4 class="page-head-line">Quotes!</h4>
  54.                 </div>
  55.             </div>
  56.            
  57.             <div class="row">
  58.                 <div class="col-md-12">
  59.                     <?php
  60.                     $userid = $userRow['user_id'];
  61.                         $query = "SELECT * FROM tbl_quotes ORDER BY quote_id DESC";      
  62.                         $records_per_page=10;
  63.                         $newquery = $crud->paging($query,$records_per_page);
  64.                         $crud->dataview($newquery,$userid);
  65.                     ?>
  66.                 </div>
  67.             </div>
  68.            
  69.             <div class="row">
  70.                 <div class="col-md-12">
  71.                     <table class='table table-striped'>
  72.                         <tr>
  73.                             <td colspan="7" align="center">
  74.                                 <div class="pagination-wrap">
  75.                                     <?php $crud->paginglink($query,$records_per_page); ?>
  76.                                 </div>
  77.                             </td>
  78.                         </tr>
  79.                     </table>
  80.                 </div>
  81.             </div>
  82.         </div>
  83. </div>
Advertisement
Add Comment
Please, Sign In to add comment