Fetching a post from the database based on a query parameter
There are two things that jump out at me:


You assume $_GET['post'] exists.

If someone just goes to post.php without specifying a parameter, $_GET['post'] is not set -- and any attempt to read it would trigger a notice like "Undefined index: post". Checking the length won't make that notice go away; even the act of getting the length starts with the assumption that your parameter exists.

You really ought to put that variable into a known state before you make any assumptions about it. It might be as simple as, say:

$requestedID = isset($_GET['post']) ? $_GET['post'] : null;


You don't even need the strlen check; null and '' aren't numeric, so they'd both fail the is_numeric check.

(Course, the bigger issue is that you have error reporting set to ignore notices. You should generally be developing with error reporting turned all the way up, even if you turn it back down for production.)
You repeat the same error-case code three times.  If you ever want to change how you handle nonexistent or unspecified post IDs, you have to change the code in three places.

That could be fixed by changing the flow a bit.

$requestedID = isset($_GET["post"]) ? $_GET['post'] : null;
$row = null;

if (is_numeric($requestedID)) {
  if ($stmt = $mysqli-&gt;prepare("SELECT * FROM posts WHERE id =?")) {
    $stmt-&gt;bind_param('s', $requestedID);
    $stmt-&gt;execute();
    $result = $stmt-&gt;get_result();

    # oh...this too.  $result can be false if something went wrong.
    if ($result &amp;&amp; $result-&gt;num_rows &gt; 0) {
      $row = $result-&gt;fetch_assoc();
    }
  }
}

// $row is only set (and truthy!) if you succeeded
if ($row) {
  // logic for the content
}
else {
  header("Location: index.php");
  // exit(); not necessary if this is the last line of the script 
}