Okay, so I have a database that stores the name of an uploaded file in a column called filename.
I am trying to use PHP to show that file (stored in the file-system, not database) by taking the filename as stored in the database and concatenating it onto the HTML tag, like so:
$stmt = $db->dbh->query("SELECT id, filename FROM images");
$stmt->setFetchMode(PDO::FETCH_BOTH);
$path = '';
while ($row = $stmt->fetch()) {
$path = 'i/' . $row['filename'];
echo "<img src=" . $path . "/>";
}
However, it's not showing anything. What am I doing wrong, or what is a better way to accomplish this?