Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="utf-8">
  5.     <title>PHP&amp;MySQL - View post | Zadaca 3</title>
  6.     <link rel="stylesheet" type="text/css" href="css/style.css">
  7. </head>
  8. <body>
  9.     <nav>
  10.         <div class="logout">
  11.             <a href="logout.php">Logout</a>
  12.         </div>
  13.     </nav>
  14.    
  15.     <div class="container">
  16.     <?php
  17.     session_start();
  18.    
  19.     include ('include/connection.inc.php');
  20.  
  21.     $id = $_GET['id'];
  22.  
  23.    
  24.     $sql = "SELECT * FROM 'posts' WHERE id=$id";
  25.  
  26.     $result = mysqli_query($conn, $sql);
  27.    
  28.  
  29.     while($row = mysqli_fetch_assoc($result))
  30.     {
  31.         //echo '<h1></h1>';
  32.         echo '<h1>'.$row['title'].'</h1>';
  33.         echo '<br>';
  34.         echo '<img class="header-img" src="images/'.$row['image'].'">';
  35.         echo '<br>';
  36.         echo '<p><b>Published: </b>'.$row['date_created'].'</p>';
  37.         echo '<p>'.$row['content'].'</p>';
  38.     }
  39.  
  40.  
  41.  
  42.    
  43.     ?>
  44.        
  45.         <p>Back to <a href="dashboard.php">Dashboard</a></p>
  46.     </div>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement