<div id="profile">
<?php
require 'users/'. $login .'/index.php';
//это не относиться к постам
?>
<?php
function getPost(){
global $connection, $row;
$num = $row['id'];
$sql = "SELECT * FROM `posts` WHERE `user_id` = '{$num}' ORDER BY `id` DESC ";
# ^ хочу достать все посты, с id пользователя
$result = mysqli_query($connection, $sql);
$posts = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $posts;
} ?>
<?php
$posts = getPost();
?>
<?php if($posts == true) : ?>
<div id="photos1">
<?php foreach($posts as $post): ?>
<!-- POST START -->
<div id="post">
<div id="who-post">
<div id="usr-p">
<style>
#usr-p {
background: white;
width: 50px;
height: 50px;
border-radius: 100%;
}
</style>
</div>
<div id="who-name">
<?php
echo $name['login'];
?>
</div>
<h2 id="date-post"><?php echo $post['time']; ?></h2>
</div>
<h2 id="name-post"><?php echo $post['content']; ?></h2>
<?php if( $post['image'] == NULL) : ?>
<?php else : ?>
<div id="post-img">
<style> #post-img { background-image: url("<?php echo $post['image']; ?>"); } </style>
</div>
<?php endif; ?>
<hr id="und1"> <style>#und1 { margin-left: auto; margin-right:auto; width:780px; padding: 0px; background-color: #6e6969; }</style>
<div id="post-liked"> <style> #post-liked {display: flex;} </style>
<div id="love-post"></div>
<h2>0</h2>
<div id="comm-post"></div>
<h2>0</h2>
</div>
</div>
</div>
<!-- POST END -->
<?php endforeach; ?>
</div>
<?php else :?>
<h2 id="u-d">Пользователь пока еще ничем не поделился <span id="green-c">:(</span></h2>
<?php endif; ?>
#photos1 {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
border-radius: 5px;
display: block;
height: 1000px;
}
#post {
color: white;
width: 780px;
padding: 10px;
margin-bottom: 100px;
margin-top: 100px;
min-height: 60px;
background-color: #524e4e;
margin-top: 10px;
font-family: 'Montserrat', sans-serif;
border-radius: 5px;
margin-left: auto;
margin-right: auto;
}
#who-post {
width: 800px;
display: flex;
color: white;
font-family: 'Montserrat', sans-serif;
height: 50px;
}
#usr-p {
background: white;
width: 50px;
height: 50px;
border-radius: 100%;
}
#who-name {
display: flex;
justify-content: center;
align-items: center;
margin-left: 10px;
font-size: 25px;
}
#date-post {
font-size: 23px;
display: flex;
align-items: center;
justify-content: center;
color: rgb(124, 122, 122);
margin-right: 30px;
margin-left: auto;
}
#name-post {
margin-bottom:15px;
}
#post-img { background-image: url("<?php echo $post['image']; ?>"); } /*это из php*/
#und1 {
margin-left: auto;
margin-right:auto;
width:780px;
padding: 0px;
background-color: #6e6969;
}