Привет, я пытаюсь получить данные из моего sql с идентификатором, post_author, post_date, post_content, post_title и post_status.
Прямо сейчас мой основной для post.php это
<?php require_once("../../includes/session.php"); ?>
<?php require_once("../../includes/db_connection.php"); ?>
<?php require_once("../../includes/functions.php"); ?>
<?php
$post = "";
$id = 1;
// ^'will be using $_GET['id'] to get current post
find_post_by_id($id, $public=true);
?>
<?php include("../../includes/layouts/header.php") ?>
<div class="container post">
<h1><?php echo htmlentities($post["post_title"]); ?></h1>
<p>Auther & postdate n time</p>
<hr class="hrpost">
<div class="content">
Content in form of the text
</div>
</div>
<?php include("../../includes/layouts/footer.php") ?>
и в functions.php у меня есть это
function confirm_query($result_set) {
if (!$result_set) {
die("Database query failed.");
}
}
function find_post_by_id($post_id, $public=true) {
global $connection;
$safe_page_id = mysqli_real_escape_string($connection, $post_id);
$query = "SELECT * ";
$query .= "FROM posts ";
$query .= "WHERE id = {$safe_page_id} ";
if ($public) {
$query .= "AND post_status = \"publish\" ";
}
$query .= "LIMIT 1";
$post_set = mysqli_query($connection, $query);
confirm_query($post_set);
if($post = mysqli_fetch_assoc($post_set)) {
return $post;
} else {
return null;
}
}
а затем, когда я пытаюсь понять это, он говорит ->
Предупреждение: недопустимое смещение строки 'post_title' в строке D 13.
Почему так и как исправить???