connect_error) { die("Connection failed: " . $connection->connect_error); } $connection->set_charset("utf8mb4"); // Fetch photos joined with articles, sorted by ArticleID DESC $sql = " SELECT p.PhotoID, p.ArticleID, p.PhotoPath, p.Caption, a.Title AS ArticleTitle, a.CreatedAt AS ArticleDate FROM ArticlePhotos p JOIN Articles a ON p.ArticleID = a.ArticleID ORDER BY p.ArticleID DESC "; $result = $connection->query($sql); ?>

Gallery

num_rows > 0): ?> fetch_assoc()): ?>
No photos found.
free(); $connection->close(); require_once 'footer.php';