Answer the question
In order to leave comments, you need to log in
Why are krakozyabry displayed from the database?
Help to correctly display content from the database, a site on Denver. Encoding - utf8.
I did this: header('Content-Type: text/html; charset=utf-8');
To get posts:
function get_posts() {
global $mysqli;
$sql = "SELECT * FROM posts";
$result = $mysqli->query($sql);
$result = mysqli_fetch_assoc($result);
return $result;
}
foreach($posts as $post) {
echo '
<div class="post">
<div class="post-author"><a href="/profile.php?id='.$post['author-id'].'">'.$post['author-name'].' '.$post['author-surname'].'</a></div>
</div>
';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question