Unable to include the file, but the code does work

  mysql, php

I’m trying to print out pdf files from a MySQL database using PHP. Check this link for the ‘tutorial’ I’m following: https://joshuaotwell.com/php-mysql-blob-pdf-display-in-browser/

I get this warning message: Warning: include(include.php): failed to open stream: No such file or directory in C:xampphtdocsPortfoliotemplatesbase_html.php on line 2

This happens when I try to include my ‘include.php’ file, where I connect to the database. The wierd thing to me is that the code does still work and prints out the name of the item in the database. Probably because it’s a warning and not an error, but still. Can anyone help me how to clear this message?

Below is the code from my projects.php file.

include '../include.php';

$sql = "SELECT id, name
        FROM projects
        ORDER BY name ASC;";
$result = $conn->query($sql);
foreach ($result as $row) {
    $records[] = [
        'id' => $row['id'],
        'name' => $row['name']
$title = 'Display PDF File';
include __DIR__ . "display_html.php";
$output = ob_get_clean();

include __DIR__ . "base_html.php";


My directory is like this: xampp/htdocs/portfolio/templates
My include file is in the portfolio folder and the projects.php file, the code above, is in the templates folder together with the 2 folders called display_html.php and base_html.php.

Source: Ask PHP