Пример #1
0
<?php

require '../php_library/class_frontend.php';
$id = 1;
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
$obj = new Frontend();
$posts = $obj->select_post_from_post_table_by_user_id($id);
$username = $obj->user_name_by_user_id($id);
include 'header.php';
?>

<div class="container">
    <div class="row">
        <div class="col-sm-8 blog-main">
            <?php 
if ($posts->num_rows == 0) {
    echo "<h2>No post found by this Author";
} else {
    echo "<h1>Showing posts written by {$username} </h1> <hr><br>";
}
while ($post = $posts->fetch_assoc()) {
    ?>
                <div class="blog-post">
                    <h2 class="blog-post-title">
                        <a href= "post.php?id=<?php 
    echo $post['id'];
    ?>
"><?php 
    echo $post['title'];