So I have PHP/MySQL setup where I can upload a blob file. What I want to do is to be able to download the file from my website. I already have it setup where I can upload it from a form, but I am running into trouble trying to pull it from the database and download it. Here is the code where I want to show it, what I want is to add another td that contains a link to download the file:
<body>
<?php
require_once "connect.php";
include "header.php";
try
{
$sql = 'SELECT * FROM items WHERE ID = :ID';
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':ID', $_GET['ID']);
$stmt->execute();
$result = $stmt->fetchAll();
echo '<table>';
foreach ($result as $row)
{
echo ' <tr><td><th>ID</th></td><td>'.$row['ID'] . '</td></tr>
<tr><td><th>Title</th></td><td>'.$row['title'] . '</td></tr>
<tr><td><th>Summary</th></td><td>'.$row['summary'] . '</td></tr>
<tr><td><th>Author\'s First Name</th></td><td>'.$row['afirst'] . '</td></tr>
<tr><td><th>Author\'s Last Name</th></td><td>'.$row['alast'] . '</td></tr>';
}
echo '</table>';
}//try
catch (PDOException $e)
{
echo 'Error fetching users: <br />ERROR MESSAGE:<br />' .$e->getMessage();
exit();
}
include "footer.php";
?>
</body>
</html>
I have tried using $_PHP['SELF'] but have not had any luck.