MySQL Fetch Array Linking
Posted: Mon Aug 18, 2008 11:14 am
I have this Upload script that works fine for uploading files into the MySQL database...Now there is a public page where these files can be available for download, - what Im trying to do is get the file id to display and the file name and have it linked to the file so users can click on it and download the file...However the only thing that seems to be showing is a blank white page. - Any advice?
<?php
// Connects to your Database
mysql_connect("**", "***", "***") or die(mysql_error());
mysql_select_db("legion") or die(mysql_error());
$query = "SELECT id, name FROM uploads";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while(list($id, $filename) = mysql_fetch_array($result))
{
?>
<a href="download.php?id=<?php=$id;?>"><?php=$filename;?></a> <br>
<?php close();
?>
<?php
// Connects to your Database
mysql_connect("**", "***", "***") or die(mysql_error());
mysql_select_db("legion") or die(mysql_error());
$query = "SELECT id, name FROM uploads";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while(list($id, $filename) = mysql_fetch_array($result))
{
?>
<a href="download.php?id=<?php=$id;?>"><?php=$filename;?></a> <br>
<?php close();
?>