所以我有PHP / MySQL设置,我可以上传blob文件。我想要做的是能够从我的网站下载文件。我已经有了设置,我可以从表单上传它,但我遇到了麻烦,试图从数据库中取出并下载它。这是我想要显示它的代码,我想要的是添加另一个包含下载文件的链接的td:
<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>
我尝试过使用$ _PHP ['SELF'],但没有运气。