Notice: Undefined index: id in C:\xampp\htdocs\personal\post.php on line 9
<?php include "libs/db.php"; include "libs/config.php"; include "function.php"; $db = new database(); $id = $_GET['id']; $query = "SELECT * from posts WHERE id = '$id'"; $posts = $db->select($query); ?> <!DOCTYPE html> <html> <title>W3.CSS Template</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway"> <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <style> body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif} </style> <body class="w3-light-grey"> <!-- w3-content defines a container for fixed size centered content, and is wrapped around the whole page content, except for the footer in this example --> <div class="w3-content" style="max-width:1400px"> <!-- Header --> <header class="w3-container w3-center w3-padding-32"> <a href="index.php?container.php"><h1>MY BLOG</h1></a> <p>Welcome to the blog of <span class="w3-tag">Programmer</span></p> </header> <?php $row = $posts->fetch_array() ;?> <!-- Grid --> <div class="w3-row"> <!-- Blog entries --> <div class="w3-col l8 s12"> <!-- Blog entry --> <div class="w3-card-4 w3-margin w3-white"> <img src="images/<?php echo $row['image'];?>" alt="Nature" style="width:100%"> <div class="w3-container"> <h3><?php echo $row['title'];?></h3> <h5>Posted by Sulaymonov on <span class="w3-opacity"><?php echo formatDate($row['date']);?></span></h5> </div> <div class="w3-container"> <p><?php echo $row ['content'];?></p> <div class="w3-row"> <div class="w3-col m8 s12"> </div> <div class="w3-col m4 w3-hide-small"> <p><span class="w3-padding-large w3-right">Comments <span class="w3-tag">0</span></span></p> </div> </div> </div> </div> <hr> <!-- END BLOG ENTRIES --> </div>
$id = $_GET['id'];
$id = isset($_GET['id']) ? $_GET['id'] : '';
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)