I'm sure this sounds like an easy task, but it's proving to be painful for me.
I have an upload form that would allow a user to upload 2 items, a file and a small 'image' regarding the file, along with some text.
Offending code:
<?php
if(isset($_GET['id']))
{
// if id is set then get the file with the id from database
connection line
$id = $_GET['id'];
$query = "SELECT name, type, size, content, desc, title, tinypic " .
"FROM upload WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;
mysql_close;
exit;
}
?>
<?php
//The HTML crap
print "<html>";
print "<head>";
print "<title>Download File From MySQL</title>";
print '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
print "</head>";
print "<body>";
//Connection line
connection line
//Selects the information from the database
$query = "SELECT id, name 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) = mysql_fetch_array($result))
{
//Prints out the list of uploaded files
print '<a href="get.php?id=<?php echo $id; ?>"><?php echo $name; ?></a><br>';
}
}
mysql_close;
?>
</body>
</html>
What it does:
Nothing. :glare:
Double-checked, no parse errors, no sql errors, database has data, and it's not echoing anything. I took it down to basically nothing, but it still doesn't kick back data.