I created an "images" table like yours. Here is basic working code sample. The folder containing the script has a subfolder "images".
<?php
include 'config.php';
$res = $db->query("SELECT file_name
, game
FROM images
");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
<style type='text/css'>
.wrapper {
text-align: center;
padding: 20px;
border-bottom: 2px solid gray;
}
</style>
</head>
<body>
<?php
foreach ($res as $row) {
echo "<div class='wrapper'>
<img src='images/{$row['file_name']}' alt='Game image'>
<br>
{$row['game']}
</div>
";
}
?>
</body>
</html>