I'm having trouble working with this file called download.php. It creates a tabled listing of files that a separate page uploads to the server. I have that part working great, but now I want to add something to this output page. I have different icons depending on the type of download it is ( file, song, ad ). I want these icons to show up in the very first cell of the table.
My problem is I'm not sure how to define, then call these out. Below you will see the tables and cells the data goes into. I'm very new to php and sql so please be descriptive with the ideas.
<?php
error_reporting(E_ALL);
if(isset($_GET['id']))
{
include 'inc/config.php';
include 'inc/opendb.php';
$id = $_GET['id'];
$query = "SELECT name, type, size, path, dis FROM upload WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $dis, $filePath) = mysql_fetch_array($result);
header("Content-Disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
header("Content-type: $dis");
readfile($filePath);
include 'inc/closedb.php';
exit;
}
?>
<html>
<head>
<title>Downloads</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:active {
color: #FFFFFF;
}
a:hover {
color: #FFFFFF;
}
.style1 {
border: 2px solid #0000FF;
background-color: #000000;
}
.style3 {
text-align: center;
border: 2px solid #0000FF;
background-color: #000000;
}
.style4 {
text-align: right;
border: 2px solid #0000FF;
background-color: #000000;
}
</style>
</head>
<body style="color: #FFFFFF; background-color: #808080;">
poop poop pooop
<?php
include 'inc/config.php';
include 'inc/opendb.php';
$query = "SELECT id, name, dis FROM upload";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while(list($id, $name, $dis) = mysql_fetch_array($result))
{
?>
<center><table style="width: 50%; float: left; height: 42px;" class="style1" align="left">
<tr><td class="style4" style="width: 27px; height: 23px;"><img src="../images/files.jpg"</td>
<td style="width: 62%; height: 23px;" class="style3"><?=$dis;?></td>
<td class="style4" style="width: 140px; height: 23px;"><a href="download.php?id=<?=$id;?>"><img src="../images/download.gif" height="23" width="140" border="0"></a></td>
</tr>
</table>
</center>
<?php
}
}
include 'inc/closedb.php';
?>
</body>
</html>