MySQL Fetch Array Linking

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
icepirates
Forum Newbie
Posts: 6
Joined: Mon Aug 18, 2008 11:11 am

MySQL Fetch Array Linking

Post by icepirates »

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();
?>
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: MySQL Fetch Array Linking

Post by ghurtado »

Unless short tags are enabled in your server, you will have to use <?php echo
Post Reply