I'm having problems directing to the downloads ive tried echoing the the downloads/$filename and it comes out fine ive even tried adding in the whole url with it but it keeps giving me a 404 error.

<?php

  include('connection.php');

  $type = $_GET['type'];

  $did = $_GET['did'];

  if ($type == 'download')
  {

$query = "select filename from downloads where id=$did";

$result = mysql_query($query) or die(mysql_error());

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{

  $filename = $row['filename'];

}

if (mysql_num_rows($result) <> '1')
{

  echo "<center><b>Download Not Found</b></center>";

  exit();

}

else
{

  $query = "select * from dlcount where did=$did";

  $result =  mysql_query($query) or die(mysql_error());

  if (mysql_num_rows($result) <> '1')
  {

    $query = "insert into dlcount (count, did) values ('1', $did)";

    $result = mysql_query($query) or die(mysql_error());

    header ('Location: downloads/$filename');

  }

  else
  {

    $query = "select count from dlcount where did=$did";

    $result = mysql_query($query) or die(mysql_error());

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {

      $count = $row['count'];

      $count = $count+1;

    }

    $query = "update dlcount set count=$count where did=$did";

    $result = mysql_query($query) or die(mysql_error());

    header ('Location: downloads/$filename');

  }

}

  }

?>

    header (" Location: downloads/$filename ");

      Write a Reply...