Blog Home

BlogHome

Test-testThursday, October 1st, 2026

Test-test

MD - Demo PostWednesday, September 30th, 2026

356 Rally in the snow.

## H2 Heading * List Item * List Item * List Item * List Item * Nested - List Item * Nested - List Item * Nested - List Item 1. Nested OL [Thing](https://google.com) 1. Read More…

Better TitleWednesday, September 23rd, 2026

The Lake Boat

A boat at the lake.

Demo ImageWednesday, September 23rd, 2026

356 Rally in the snow.

This is the image demo. This is the image demo. Read More…

Demo Post with 🦖Wednesday, September 23rd, 2026

Demo Post Demo post line 2. Demo post line 3.

$_SERVER["SCRIPT_NAME"]
/php/blog/index.php

print_r($_GET)
Array
(
)


print_r($_POST)
Array
(
)


print_r($_SESSION)
Array
(
)


print_r($_FILES)
Array
(
)


<?php

require_once '../includes/connection.php';

/**
 * utility_funcs.php
 * Updated with new functions
 * ch16
 * convertToParas() and getFirst()
 */
require_once '../includes/utility_funcs.php';
// create database connection
$conn = dbConnect('read');
$sql = "SELECT
            article_id,
            image_id,
            title, 
            article, 
            DATE_FORMAT(created, '%W, %M %D, %Y') AS created_date, 
            filename, 
            caption
        FROM php_blog_blog 
        LEFT JOIN php_blog_images USING (image_id)
        ORDER BY created DESC"; //sorting by created 20xx-xx-xx not the alias

$result = $conn->query($sql);
if (!$result) {
    $error = $conn->error;
}


# Robert's Custom Variable (Do Not Use)
$tools = true;

# The header section of the layout.
include("../includes/header.php");
?>

<main>
    <h2><?php echo $folder_name; ?><span><?php echo $file_name; ?></span></h2>

    <?php if (isset($error)) {
        echo "<p>$error</p>";
    } else {
        while ($row = $result->fetch_assoc()) {
            echo "<h2 class=\"clear\">" . safe($row['title']) . "<span>{$row['created_date']}</span></h2>";
    ?>
            <?php if (!empty($row['filename'])) { ?>

                <img src="/php/blog/images/thumbs/<?= safe($row['filename']) ?>" alt="<?= safe($row['caption']) ?>">


    <?php }
            if ($row) {

                $extract = getFirst($row['article']);
                echo '<p>' . safe($extract[0]);
                if ($extract[1]) {
                    echo '<a href="details.php?article_id=' . $row['article_id'] . '">
                            Read More&hellip;</a>';
                }
                echo '</p>';
            }
        }
    }
    ?>
</main>
<?php
# The side-bar section of the layout use custom path to load from a different folder.
include("sidebar.php");

# The footer section of the layout.
include("../includes/footer.php");
?>